代码:
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 52
Warning: preg_match_all() [function.preg-match-all]: Empty regular expression in F:\php\doom\newfile.php on line 52
能否说明下“@抑制错误”的具体语法呢
php中,用try/catch捕获了异常,为什么还会有警告?有没有办法去掉呢?
答案:4 悬赏:60 手机版
解决时间 2021-01-24 15:51
- 提问者网友:世勋超人
- 2021-01-24 08:47
最佳答案
- 五星知识达人网友:第四晚心情
- 2021-01-24 10:13
试试把error_reporting(0);这句放在php文件的开头
至于@
则是在函数前加 如
while ($row = @mysql_fetch_assoc($qrt))
至于@
则是在函数前加 如
while ($row = @mysql_fetch_assoc($qrt))
全部回答
- 1楼网友:酒安江南
- 2021-01-24 13:01
你的警告是什么??发来看看。
强制抑制警告可用error_reporting(0); 但不推荐。
- 2楼网友:痴妹与他
- 2021-01-24 12:16
因为它既抛出异常又触发错误, 你需要@抑制错误, try并不负责屏蔽错误触发, 只负责接收抛出的异常
- 3楼网友:三千妖杀
- 2021-01-24 11:30
php 不提供内置抛出异常,如果用try catch 必须自定义异常,并且手动throws才可以!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯