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.
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. |