<?php
$a = array();
$b = $a['test'];
?>
以上代码单独执行时只会报:PHP Notice: Undefined index: test in /private/var/folders/lr/hbwptx4s1017kl_hlr4d9b4r0000gn/T/CodeRunner/Untitled.php on line 3
但是在lumen框架中却会抛出一个ErrorException异常:
(1/1) ErrorException
Undefined index: test
in ExampleController.php (line 23)
at Application->Laravel\Lumen\Concerns\{closure}(8, 'Undefined index: test', '/Users/kai/work/api/app/Http/Controllers/ExampleController.php', 23, array())
in ExampleController.php (line 23)
at ExampleController->testOrder()
at call_user_func_array(array(object(ExampleController), 'testOrder'), array())
in BoundMethod.php (line 29)
1 回答
慕姐8265434
TA贡献1813条经验 获得超2个赞
因为设置了: error_reporting(-1);
,然后用set_error_handler
处理错误,在处理的时候抛出异常。
相关代码在IlluminateFoundationBootstrapHandleExceptions::bootstrap
- 1 回答
- 0 关注
- 907 浏览
添加回答
举报
0/150
提交
取消