Re: [請益] fopen 可以射後不理嗎?

看板PHP作者 (恨怨悲苦憎怒嗔)時間14年前 (2009/09/11 22:40), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/3 (看更多)
如果在linux上可以這樣用 function fire_and_forget() { system('php yyy.php > /dev/null &'); } 官方網站說明: Note: 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. ※ 引述《visa9527 (高級伴讀士官長)》之銘言: : 因為我想跑一個功能是觸發伺服器去做一個動作 : 可是那個動作是要去資料庫跑幾百萬筆資料 ~ 也不會有回應顯示在網頁上 : 所以想知道 PHP 有沒有什麼功能可以射後不理 : 我想做到去瀏覽一個 xxx.php 後馬上就結束 : 可是 xxx.php 會用 fopen 再去呼叫另一個 Server 上的 yyy.php : 然後這個 yyy.php 開始執行後就會一直跑一直跑一直跑資料庫 : 我希望瀏覽器看 xxx.php 時馬上就結束 : 讓背景的伺服器跟 yyy.php 自己去跑就好 : fopen 可以射後不理嗎? 不用等待回應 PHP 就繼續往下做 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.110.119.61

09/14 15:07, , 1F
3Q 3Q 感謝您
09/14 15:07, 1F
文章代碼(AID): #1Agc503C (PHP)
文章代碼(AID): #1Agc503C (PHP)