Home > Backend Development > PHP Tutorial > php syntax error, unexpected $end How to solve the error

php syntax error, unexpected $end How to solve the error

WBOY
Release: 2016-07-25 09:12:52
Original
1213 people have browsed it

Encountered the following php error: parse error: syntax error, unexpected $end in script.php on line xx After debugging, I found that the line that caused the error was a line in the middle of the file.

  1. //$str .= "?>n";
Copy the code

I remembered that the end mark allowed by the PHP interpreter can also be commented with a single line, that is, //$str .= "?>n"; is interpreted as a comment before the end tag. The content of the comment is //$str .= ", and the n"; after ?> will be interpreted as the content outside the php block and is output as html. ! The result is that after adding // to the $str .= "?>n"; line as a comment, there is an additional end tag of ?>, causing the original real end tag to become unexpected.

Solution: Just delete this line.

Editor’s reminder: Don’t write anything else in the lines where the PHP opening and closing tags are located.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template