2つのPHP関数があるとしましょう。
function first()
{
$keyword = $this->input->post('keyword');
//search for the result and show it to users.
$this->search->search($keyword);
//send the keyword to save it into the db.
$this->second($keyword);
}
function second($keyword)
{
//saving a search keyword in the db
}
できるだけ早く結果を送信し、検索語をDBに保存したいと思います。
ただし、特定の時間の後で2番目のスクリプトを実行したいと思います。
検索結果をできるだけ早く顧客に届けたいからです。
ユーザーが最初のPHPスクリプトを実行した後に2番目のPHPスクリプトを実行する方法はありますか?
* I don't want to use Cron Job
* I wanna run those two script separatly.
* don't want to use sleep because it will stop the first script for certain times.