php 语法解析错误,引用 stack overflow 上的回答:

So turns out the resulting problem was in short_open_tags - any code with a php short tag

`<?`
must be converted to
`<?php`

therefore the multiple lines above was preventing this from happening. After modifying them my errors are gone and it's now functioning as it should.

即简写成 <? 的内嵌 php 需要修改成标准版 <?php

发现在同样是 nginx 的服务器上,有的可以这样 <?if(expression):?>,解析没有问题,而有的服务器只支持 <?php if(expression):?>

这应该是 php 版本问题,为向前兼容,最好每个独立语句都要把 php 标识加上。