duanguoyin7008
2016-03-03 03:04
浏览 79
已采纳

PHP 7.0.2在出错时执行回溯

I'm running PHP version 7.0.2 on OS X El Capitan and every time I execute a PHP script that contains some erroneous code, it reports the error and then seems to perform a backtrace automatically. I'm not so sure if this is a new feature in PHP 7, however I cannot seem to find mention of it anywhere or anyone else who's facing a similar problem.

For Example:

<?php
   echo $a;
?>

Will return the following output if executed from CLI:

PHP Notice:  Undefined variable: a in /Path/to/file.php on line 2
PHP Stack trace:
PHP   1. {main}() /Path/to/file.php:0

Notice: Undefined variable: a in /Path/to/file.php on line 2

Call Stack:
    0.0002     350944   1. {main}() /Path/to/file.php:0

Any insight on what might be causing the problem is welcome. Thanks.

图片转代码服务由CSDN问答提供 功能建议

我在OS X El Capitan上运行PHP版本7.0.2,每次执行包含的PHP脚本 一些错误的代码,它报告错误,然后似乎自动执行回溯。 我不太确定这是否是PHP 7中的新功能,但我似乎无法在任何地方或其他遇到类似问题的人中找到它。</ p>

例如:< / p>

 &lt;?php 
 echo $ a; 
?&gt; 
 </ code> </ pre> 
 
 

将返回以下输出 如果从CLI执行:</ p>

  PHP注意:未定义的变量:第2行的/Path/to/file.php 
 
 
 
 
 
堆栈跟踪:
 
PHP 1. {main}  ()/Path/to/file.php:0
nnNotice:未定义的变量:第2行的/Path/to/file.php 
 
呼叫堆栈:
 0.0002 350944 1. {main}()  /Path/to/file.php:0
nn

欢迎任何有关可能导致问题的原因的见解。 谢谢。</ p> </ DIV>

2条回答 默认 最新

相关推荐 更多相似问题