@hakre あなたが与えたものは、ユーザーが応答を待つ時間を短縮しませんでした。
これに対する最良の解決策を見つけました:
yii の runactions 拡張機能
これは、コントローラーのバックグラウンド アクションから実行できる拡張機能です。使い方はいくつかあります。私の場合に最適なものはこれです
public function actionTimeConsumingProcess()
{
if (ERunActions::runBackground())
{
//do all the stuff that should work in background
mail->send()
}
else
{
//this code will be executed immediately
//echo 'Time-consuming process has been started'
//user->setFlash ...render ... redirect,
}
//User information
echo "Submit Success!"
}
そして、それは機能しますが、ajaxリクエストがなくても、ajaxリクエストを行うと、何らかの理由で機能しません。だから私は使用しました:
ERunActions::httpPOST($this->createAbsoluteUrl('Form/Submit'), array('to'=>'mail@domain.com', 'subject'=>'This is the subject'));
そして、その仕事は素晴らしいですが、これは理想的な解決策ではありません.