set_time_limit
(PHP 3, PHP 4 )set_time_limit -- Limits the maximum execution time
Description
void set_time_limit ( int seconds)
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini. If seconds is set to zero, no time limit is imposed. When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
警告
set_time_limit() has no effect when PHP is running in 安全模式. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
注: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. 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. See also: max_execution_time and max_input_time ini directives.
(PHP 3, PHP 4 )set_time_limit -- Limits the maximum execution time
Description
void set_time_limit ( int seconds)
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini. If seconds is set to zero, no time limit is imposed. When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
警告
set_time_limit() has no effect when PHP is running in 安全模式. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
注: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. 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. See also: max_execution_time and max_input_time ini directives.
解决方案 »
- 配置环境的时候,PHP无法载入MySQL动态库,麻烦大家帮忙看看!
- php即时聊天,请教方案
- 老是显示Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
- mysql排序难题——怎样在top榜中使每个用户的重复记录不会被重复计数
- 请教各位大虾一个问题,急!!!!!!在线等!
- 高手帮忙看看这个正则该如何写才行?
- ftp_connect 问题/.
- 谁能解释下socket_select最简单的用法
- php getheaders的一点疑惑(curl也会有这个问题)
- curl 手机网页
- ASP转换到PHP中com的问题
- PHP新手请教帮偶看看如何排错呀
主要是能否给出一个友好的提示。如
系统忙,稍后在试。
也就是如何捕获异常
echo "<srcipt lanugage='javascript'>alert('系统忙,稍后在试');<scrpt>";
apache 好像可以根据错误的id,自动重定向到某页,脑袋不好使,又给忘了!气忿!!!!
echo "系统忙,稍后在试";exit;
}
(PHP 4 >= 4.0.1)restore_error_handler -- Restores the previous error handler function
Description
void restore_error_handler ( void )
Used after changing the error handler function using set_error_handler(), to revert to the previous error handler (which could be the built-in or a user defined function) See also error_reporting(), set_error_handler(), trigger_error(). 它有一个例子,可以试试另外,前端显示最好不要用set_time_limit,没有必要的时候,尽量不要用它
所以这个方法:
if(!$rresult = mssql_query($query) ){
echo "系统忙,稍后在试";exit;
}
不行
//当发生错误时,在一个自定义的表格里显示错误信息,并自动发一封邮件到技术支持人员set_error_handler("user_define_error_handle");function user_define_error_handle($errorNo, $errorMessage, $errorFile = __FILE__, $errorLine = __LINE__)
{
$errorContent = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td background=\"images/bk_head.jpg\"><img src=\"images/error.gif\"></td>
</tr>
<tr>
<td background=\"images/bk_main.jpg\">
<B>ERROR:</B> $errorMessage
<P>Please try again, or contact us and tell us that
the error occurred in line ".$errorLine." of file '".$errorFile."'";
if ($errorNo == E_USER_ERROR || $errorNo == E_ERROR)
{
$errorContent .= "<P>This error was fatal, program ending";
$errorContent .= "</td></tr></table><br>";
echo $errorContent;
exit;
}
$errorContent .= "</td></tr></table><br>";
echo $errorContent;
//send a mail to somebody
include_once('mail/htmlMimeMail.php');
$mail = new htmlMimeMail();
$domain = "a1-battery.co.uk";
$to_name = "to_name";
$to_email_address = "[email protected]";
$from_email_address = "[email protected]";
$subject = "there have some error in the website";
$text = $errorContent;
$html = $errorContent;
$mail->setHtml($html, $text);
$mail->setReturnPath($to_email_address);
$mail->setFrom($from_name . '<' . $from_email_address . '>');
$mail->setSubject($subject);
$mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');
$result = $mail->send(array($to_name . '<' . $to_email_address . '>'), 'smtp');
if (!$result) {
print_r($mail->errors);
} else {
//echo 'Mail sent!';
//include('ok.htm');
}
}
不行啊,好像要用到trigger_error,但我不知道trigger_error要放在那里
if(!$rresult = mssql_query($query) ){
trigger_error("错误",
FATAL);
}
不行
set_magic_quotes_runtime(0);
禁止错误4板还不能用try之类的东西捕捉错误,5版可以了