[英]Maximum execution time exceeded (PHP)
即時通訊收到此錯誤,我不知道為什么。
Fatal error: Maximum execution time of 30 seconds exceeded in E:\web\autoopti\thanks.php on line 65
我為PHP腳本編寫的代碼是:
<?php
$key = 129;
$email = $_REQUEST["payer_email"];
$first = $_REQUEST["first_name"];
$last = $_REQUEST["last_name"];
$acode = $_REQUEST["hash"];
$txt = $email . "|" . $email . "|" . $first . "|" . $last . "|" . $acode;
$outtxt = '';
for($i=0;$i<strlen($txt);)
{
for($j=o;$j<strlen($key);$j++,$i++)
{
$outtxt .= $txt{$i} ^ $key{$j};
}
}
echo "thanks";
?>
錯誤消息所指向的行是:
$outtxt .= $txt{$i} ^ $key{$j};
因此,我猜想這行代碼花費的時間太長了。 有人可以幫我解決這個問題嗎?
謝謝
檢查一下,它肯定會工作
<?php
$key = 129;
$email = $_REQUEST["payer_email"];
$first = $_REQUEST["first_name"];
$last = $_REQUEST["last_name"];
$acode = $_REQUEST["hash"];
$txt = $email . "|" . $email . "|" . $first . "|" . $last . "|" . $acode;
$outtxt = '';
for($i=0;$i<strlen($txt);)
{
for($j=0;$j<strlen($key);$j++,$i++)
{
$outtxt .= ( $txt{ $i } ^ $key{$j} ) ;
}
}
echo "thanks";
?>
請查看這是否已解決錯誤或對我發表評論
這里沒什么好奇怪的。 您的代碼運行時間太長。 您可以在PHP配置文件中增加超時限制。 但是,我建議您使用命令行PHP解釋器查看程序在這30秒內所處的位置,然后找出如何對其進行優化。
如果要繼續執行將忽略php.ini中的任何超時設置的代碼,請使用set_time_limit(0)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.