php 开启报错
2024-08-30 05:48:07
// 开启报错提醒
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();
}
?>
最新文章
- docker快速入门+搭建javaweb环境
- JavaScript----分层导航 滚动事件
- 350. Intersection of Two Arrays II
- 栈和队列的面试题Java
- the private key for is not installed on this mac
- 使用MJRefresh遇到的坑
- Haskell 几乎无疼痛入门指南
- Android checkbox和radiobutton 以及Toast和AlertDialog的使用
- Spring思维导图(MVC篇)
- 自己写的一个vii总结
- centos7安装eclipse方法
- Python菜鸟快乐游戏编程_pygame(2)
- 边框回归(bounding-Box regression)
- RequireJS - 个人小入门
- java Web三大组件--监听器
- 给已经存在的项目添加git
- Python基础10_函数
- uploadify onComplete 不执行?
- Spring事务管理—aop:pointcut expression 常见切入点表达式及事物说明
- tar 解压命令学习与总结
热门文章
- Git出错:“Please make sure you have the correct access rights and the repository exists.”
- Golang语言系列-12-网络编程
- Git连接github以及gitee等使用教程
- Nikitosh 和异或
- 如何快速排查发现redis的bigkey?4种方案一次性给到你!
- [ES6深度解析]14:子类 Subclassing
- wpf 滚动文字 跑马灯
- 【java虚拟机】jvm调优原则
- GPIO引脚速度的应用匹配
- 初识javaScript(慕课网学习笔记)