Home >Backend Development >PHP Tutorial >PHP命令行运行时,不列出语法错误信息

PHP命令行运行时,不列出语法错误信息

WBOY
WBOYOriginal
2016-06-23 14:23:381219browse

PHP 语法错误 命令行 Editplus

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

回复讨论(解决方案)

没打开错误提示功能吧。
ini文件中
display_errors

自己设置下

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

<?php// Turn off all error reportingerror_reporting(0);// Report simple running errorserror_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.inierror_reporting(E_ALL ^ E_NOTICE);// Report all PHP errors (see changelog)error_reporting(E_ALL);// Report all PHP errorserror_reporting(-1);// Same as error_reporting(E_ALL);ini_set('error_reporting', E_ALL);?>

你指的是 php warning屏蔽操作吧

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn