The problem of syntax error in html nested PHP: Parse error: syntax error, unexpected end of file in

Problem Description:

A php file is basically html code, with some php code nested in the middle, such as:
<?=$page_list;?>
Page error:

Parse error: syntax error, unexpected end of file in xxx.php


Cause Analysis:

There is no obvious syntax error in the php file. The reason for the error is the use of short tags, for example:
<? }?>

solution:

Modify the php configuration file php.ini to:
short_open_tag = Off #默认值

change into:

short_open_tag = On

short_open_tag determines whether to open short tags (ie, use the abbreviated form of the code, such as <?php?> can be replaced with <? ?>, <?= is equivalent to <? echo).
You can disable this option to facilitate embedding and use <?xml?>, otherwise you can also output through php: <?php echo'<?xml version="1.0"';?>
If you disable this option, you must use the php code start flag The complete form: <?php?>.

Original link:
https://blog.csdn.net/u014175572/article/details/52798684/

Guess you like

Origin blog.csdn.net/username666/article/details/108321569