PHP Error Parse error: syntax error unexpected end of file in test. php on line 12 Solution

  • 2021-07-02 23:43:42
  • OfStack

Today, when writing PHP programs, there are always such errors: Parse error: syntax error, unexpected end of file in *. php on line *, and then I find that file according to the prompt, and then the error always indicates that the last line is wrong, and I find the last line and find it is < /html > Dizzy, what's wrong with this? It took a long time to find the problem and share it.

The reason for this error is syntax error, which must be caused by the nonstandard writing of PHP program. I later found that the identifier of PHP statement was wrong. Under normal circumstances, it should be like this: < ? php Your PHP statement? > I wrote this: < ? Your PHP statement? > Of course, it's good to write like this, but I didn't open the short tag in php. ini, so this error was caused, and also note that, < ? There is a space behind php. If you don't write it, this error will appear. Although this error is inadvertent, it is sometimes difficult to find it. Pay attention to it.


Related articles: