有人告诉我有这样一个函数 php_check_syntax() http://www.php.net/manual/en/function.php-check-syntax.php 我想问题就这么坚决了。。我真应该RTF(Read The Fuck Mannual). 仔细一看。这个函数已近被弃用了: Note: For technical reasons, this function is deprecated and removed from PHP. Instead, use php -l somefile.php from the commandline.
这个technical reason 到底是什么呢? 先不管了,以后再慢慢研究,反正不能使用这个方法就对了。 他们的建议是使用命令行$php -l filename.php 来检查语法。 Gary Every给了我一个代码片段参考: