CakePHP3 コントローラーからビューに値渡す(パラメーターアサイン)方法です。
◯ コントローラー側(Controller)
1 2 3 4 5 | $test = 'xxx@cakephp3.com'; // パラメーターアサイン $this->set('test', $test); or $this->set(compact('test')); // compact: 文字列をキーとして同じ文字列の変数を使用 |
◯ ビュー側(Template)
1 | <?= h($test) ?> // xxx@cakephp3.com |