从CLI运行时,禁止PHP错误的HTML标记

dot*_*hen 3 php debugging command-line-interface

当我php -l someFile在CLI上运行时,输出标记为HTML标记:

$ php -l someFile.php 
<br />
<b>Parse error</b>:  syntax error, unexpected T_ECHO in <b>/home/someUser/public_html/someFile.php</b> on line <b>42</b><br />
Errors parsing someFile.php
$
Run Code Online (Sandbox Code Playgroud)

如何禁止这些HTML标记?我实际上使用自定义php.ini进行解析(示例中没有显示简化),所以如果php.ini修改将解决问题那么这很好.

谢谢.

Mik*_*e B 5

在你的ini文件中将html_errors设置为false http://php.net/manual/en/errorfunc.configuration.php#ini.html-errors

$ php -dhtml_errors=0 -l someFile
Run Code Online (Sandbox Code Playgroud)