刚从aspx转过来,还是总爱用那个思想考虑问题...
具体到这个问题,我的代码:try
{
preg_match_all($pattern,$string,$all);
}
catch (Exception $ex)
{
echo $ex->getTraceAsString();
}
我是想如果有异常,就显示一下忽略掉,但还是显示出来警告,为什么呢···警告如下
Warning: preg_match_all() [function.preg-match-all]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in F:\php\doom\newfile.php on line 52Warning: preg_match_all() [function.preg-match-all]: Empty regular expression in F:\php\doom\newfile.php on line 52
具体到这个问题,我的代码:try
{
preg_match_all($pattern,$string,$all);
}
catch (Exception $ex)
{
echo $ex->getTraceAsString();
}
我是想如果有异常,就显示一下忽略掉,但还是显示出来警告,为什么呢···警告如下
Warning: preg_match_all() [function.preg-match-all]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in F:\php\doom\newfile.php on line 52Warning: preg_match_all() [function.preg-match-all]: Empty regular expression in F:\php\doom\newfile.php on line 52
Exception是属于应用程序中开发自定义,并且要处理的问题,原则上讲Exception是一定要有对应处理的
与.net不同,php的扩展库不是一家完成的,而是众多php支持者们的奉献。
考虑到php4依然在升级,所以指望perg扩展库的开发者专为php5写一个扩展是不现实的。
注意:php4与php5有着完全不同的内核
设置 error_reporting 的值可以有不同的错误显示级别
不想设置的话可在出错函数前加 @ ,当然你需要知道这样做的后果
比较感兴趣的是:你给了 preg_match_all 什么样的参数而导致出现这样的提示