日期:2014-05-16  浏览次数:20448 次

PHP命令行运行时,不列出语法错误信息
我在命令行里运行php文件时,有语法错误也不提示,什么都不输出,没有错误的时候能正确的输出运行结果(网页源码)。我在editplus里配置调试功能的时候,有语法错误也不提示错误信息,只输出“输出完成 (耗时 0 秒) - 正常终止”,没有错误的时候能正确输出。请问是不是我的php配置文件不正确,导致php运行的时候不列出语法错误啊,谢谢。
PHP 语法错误 命令行 Editplus

------解决方案--------------------
没打开错误提示功能吧。
ini文件中
display_errors
------解决方案--------------------
自己设置下

http://php.net/manual/en/function.error-reporting.php

<?php

// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR 
------解决方案--------------------
 E_WARNING 
------解决方案--------------------
 E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR 
------解决方案--------------------
 E_WARNING 
------解决方案--------------------
 E_PARSE 
------解决方案--------------------
 E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (see changelog)
error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

?>

------解决方案--------------------
你指的是php warning屏蔽操作吧