php 开启报错
PHP 报错 开启
2023-09-27 14:21:28 时间
// 开启报错提醒
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
// 某一段代码查找异常
<?php //创建可抛出一个异常的函数 function checkNum($number) { if($number>1) { throw new Exception("Value must be 1 or below"); } return true; } //在 "try" 代码块中触发异常 try { checkNum(2); //If the exception is thrown, this text will not be shown echo 'If you see this, the number is 1 or below'; } //捕获异常 catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } ?>
相关文章
- PHP字符全角转为半角
- php中__call() 和 __callStatic方法的使用
- php 面向对象编程
- PHP 代码简洁之道 ( PHP Clean Code)
- php报错 syntax error, unexpected T_VARIABLE
- 安装PHP过程中,make步骤报错:(集合网络上各种解决方法)
- 安装php时,make步骤报错make: *** [ext/gd/gd.lo] Error 1
- 为php添加pcntl扩展,多线程
- phpstorm+wamp+xdebug配置php调试环境
- PHP 提交复选框数据
- Netbeans+CodeIgniter搭建PHP开发环境
- Laravel 中视图中使用PHP代码
- .htaccess实现php网站伪静态