2011-09-01 124 views
-1

我開發了一個PHP程序,它通過單擊按鈕打開IE。我已經使用了功能PHP代碼返回致命錯誤

system("C:\Program Files\Internet Explorer\IE.EXE"); 

但隨後成功執行程序後,我得到的錯誤:

Fatal error: Maximum execution time of 60 seconds exceeded

爲什麼會出現這種情況?

+3

什麼是IE瀏覽器使用PHP開放的目的是什麼? – xdazz

+0

不僅IE,我通過這個程序訪問我的桌面上的所有.exe。但我只在IE中遇到問題。他的致命錯誤 – user909058

+0

因爲你的腳本正在等待IE退出! – xdazz

回答

1

默認PHP已經運行(櫃面你創建一個無限循環或類似的其他內容)的腳本在60秒的時間限制,使他們不繼續運行下去

往往是長期運行的數據庫查詢,可以很容易地超過60秒

如果你的腳本確實需要多於60secs並且按照預期工作,那麼你可以使用set_time_limit(n),其中n =秒數。所以1小時會的set_time_limit(3600)

http://php.net/manual/en/function.set-time-limit.php

也爲PHP手冊中指出(系統()函數)

If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.

我所期望的,這是發生了什麼事給你

2

需要了最大執行時間

void set_time_limit (int $seconds) 

http://php.net/manual/en/function.set-time-limit.php

但是你真正應該做的是讓php腳本啓動一個批處理腳本,它啓動ie,然後立即返回。您不希望PHP腳本在執行完成之前等待。

可能像

system("start iexplore");