在编写php程序中,经常要更改环境变量,在这把一些常用的整理一下。
set_time_limit(): 在执行脚本时,经常需要设定一些时间限制,以防脚本执行时间过长。Warning: Any time spent on activity that happens outside the execution of the script such as system calls using , 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]