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.