php常用ini_set

在编写php程序中,经常要更改环境变量,在这把一些常用的整理一下。

set_time_limit(): 在执行脚本时,经常需要设定一些时间限制,以防脚本执行时间过长。Warning: Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running.

 

ini_set('default_socket_timeout', 2); : 对所有的socket请求设置timeout为2s。

修改error_reporting

$old = error_reporting();
error_reporting(E_ALL ^ E_NOTICE);
// your special code.
error_reporting($old);

 

[reference]

http://www.binarytides.com/php-script-set_time_limit-wont-take-into-account-socket-operations/

 

posted @ 2013-07-17 18:04  代码会说话  阅读(290)  评论(0编辑  收藏  举报