ThinPHP try catch抛出异常
2016-04-06 13:24
621 查看
function test1(){
try {
$error = 'Always throw this error';
throw new \Think\Exception($error);
echo 'Never executed';
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
echo 'Hello World';
}
抛出异常的简单实例
try {
$error = 'Always throw this error';
throw new \Think\Exception($error);
echo 'Never executed';
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
echo 'Hello World';
}
抛出异常的简单实例
相关文章推荐
- PHP使用file_get_contents函数POST数据
- php连接sqlserver
- ThinkPHP中数据库操作返回值总结
- LTP 分词算法实践
- 【干货】超级有用的9个PHP代码片段
- php的执行原理/执行流程
- PhpStorm+PhpStudy+xdebug 配置图解
- 解决Zend加密的PHP页面出现Fatal error: Incompatible file format: The encoded file has format major ID 1, whereas the Loader expects 4 in
- ThinkPHP 方法函数总结
- php--学习封装类 (一)(操作mysql数据库的数据访问)
- RTP 资料汇总收集
- php中提示Undefined index的解决方法
- php使用正则验证中文
- PHP的启动与终止
- PHP扩展开发及内核应用
- sysvsem,sysvshm,sysvmsg,PHP的事件驱动化设计
- 每天laravel-20160701|Repository
- 每天laravel-20160701|Repository
- 【php】new static的用法
- ThinkPHP 3 的CURD介绍