Re: [請益] fopen 可以射後不理嗎?
如果在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
09/14 15:07, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):