Home > Backend Development > PHP Tutorial > PHP syntax error, unexpected $end error causes and solutions_PHP tutorial

PHP syntax error, unexpected $end error causes and solutions_PHP tutorial

WBOY
Release: 2016-07-21 15:49:15
Original
1214 people have browsed it

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

//$str .= "?> n";

I remembered that the end mark line allowed by the PHP interpreter can also be commented in a single line, that is, //$str .= "?>n"; is interpreted as a comment before the end mark, The content of the comment is //$str .= ", and the n"; after ?> will be interpreted as the content outside the PHP block and 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. .
The solution is to simply delete this line.

PHP It is a good habit to write nothing else on the line where the opening and closing tags are.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319614.htmlTechArticleParse error: syntax error, unexpected $end in script.php on line xx After debugging for a while, an error was found. The line is a line in the middle of the file //$str .= "?n"; I remembered that the PHP interpreter allows...
Related labels:
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