2012年6月8日
摘要: 函数定义: void set_time_limit ( int $seconds ) 设置允许脚本运行的时间,单位为秒。如果超过了此设置,脚本返回一个致命的错误。默认值为30秒,或者是在php.ini的max_execution_time被定义的值,如果此值存在。 当此函数被调用时,set_time_limit()会从零开始重新启动超时计数器。换句话说,如果超时默认是30秒,同时,脚本中又设置了25秒,如set_time_limit(20)。那么,脚本在超时之前可运行总共时间为45秒。安全模式下, 该函数无效.set_time_limit()函数和配置指令max_execution_t... 阅读全文
posted @ 2012-06-08 00:29 DavidYanXW 阅读(3671) 评论(0) 推荐(1)
摘要: 1. PHP捕捉异常try...catch...<?phpfunction divide($x) { if(!$x) { throw new Exception('Division by zero!'); } else return 1/$x;}try {echo divide(5);echo divide(0);}catch(Exception $e) { echo $e->getMessage();}?>参考:phptrycatch的使用 http://blog.sina.com.cn/s/blog_610997850100utea.ht... 阅读全文
posted @ 2012-06-08 00:22 DavidYanXW 阅读(927) 评论(0) 推荐(0)