フォームからのPOSTデータ取得方法。
・ フォームから送信されるデータ(例)
1 2 | <input type="email" name="email" value="xxx@cakephp3.com"> <input type="password" name="password" value="xxx"> |
◯ 全POSTデータ取得
1 2 3 4 | $post_data = $this->request->getData(); // CakePHP 3.4~ $post_data = $this->request->data(); // CakePHP ~3.3 var_dump($post_data); // Array([email] => xxx@cakephp3.com, [password] => xxx) |
◯ 個別POSTデータ取得
1 2 3 4 | $post_data = $this->request->getData('email'); // CakePHP 3.4~ $post_data = $this->request->data('email'); // CakePHP ~3.3 var_dump($post_data); // xxx@cakephp3.com |