を働いていないコンポーネントのFlash:プロバイダコントローラ機能のレビューではCakePHP3 - 私のアプリのコントローラで
class AppController extends Controller
{
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash');
$this->loadComponent('RequestHandler');
$this->loadComponent('Cookie');
}
}
:
public function review() {
if ($this->request->is('post')) {
$userId = $this->request->session()->read('Auth.User.UserId');
$partnerId = $this->request->data('PartnerId');
$content = $this->request->data('Content');
$commentTable = TableRegistry::get('Comment');
$comment = $commentTable->newEntity();
$comment->UserId = $userId;
$comment->PartnerId = $partnerId;
$comment->Content = $content;
$comment->CreatedBy = $userId;
$comment->UpdatedBy = $userId;
$comment->Source = $this->request->session()->read('Auth.User.LoginBy');
if ($commentTable->save($comment)) {
$this->Flash->success('Thank you for review!');
} else {
$this->Flash->error('So Sorry your review was failed! Please notify for us to fixed this problem!');
}
$this->redirect('provider/' . $partnerId);
}
}
- ユーザーがレビューの成功が、フラッシュを提出」doesnのtショー。しかし、私はこのプロジェクトでテストとFlashの作業のためにyoutube(https://www.youtube.com/watch?v=eASSNS1f3V4)から別のプロジェクトのチュートリアルを作成しようとしています。
- 私の英語については申し訳ありませんが、私を助けてください。どうもありがとうございました!
plzのチェックに役立つことを願っています。 org/2.0/ja/core-libraries/components/flash.html –
ありがとうございます@トーナマーク、私はそれを解決しました。 –