PHP 异常处理
来源:互联网 发布:java调用kettle 编辑:程序博客网 时间:2024/05/18 01:29
<?php//创建可抛出一个异常的函数function checkNum($number){if($number>1){throw new Exception("Value must be 1 or below" , "666666");}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(); echo "code" . $e->getcode(); echo "line" . $e->getline(); } */ function myException( $e ){ echo 'Message: ' .$e->getMessage().'||'."code" . $e->getcode()."||"."line" . $e->getline(); } // 设置用户定义的异常处理函数 set_exception_handler("myException"); checkNum(2);?>
0 0
- PHP自定义异常处理
- PHP异常处理
- php异常处理
- PHP异常处理
- PHP异常处理
- PHP 异常处理
- php 异常处理
- PHP异常处理
- php异常处理函数
- PHP 异常处理
- PHP 异常处理
- php 异常处理机制
- PHP异常处理
- php异常处理
- PHP 异常处理
- PHP 异常处理
- PHP异常处理详解
- PHP异常处理详解
- Redis监控方案
- 关于结构图(一)
- Android ContentProvider应用
- Resnet改进的色情图片检测-nsfw
- Makefile 中subst、foreach、wildcard、notdir函数
- PHP 异常处理
- Java常考面试题9 抽象方法用哪些修饰符修饰?
- 欧几里得辗转相除法证明及推论
- iOS关于枚举的使用
- BZOJ 1131: [POI2008]Sta 树形DP
- dumpbin的使用
- 40个Java多线程问题总结
- 网站的分布式架构
- Mysql解决The total number of locks exceeds the lock table size错误