File tree Expand file tree Collapse file tree
user_guide_src/source/libraries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,18 +44,22 @@ Do one of the following:
4444
4545E.g.::
4646
47- if (strtolower( $this->request->getMethod()) !== 'post') {
47+ if (! $this->request->is( 'post') ) {
4848 return $this->response->setStatusCode(405)->setBody('Method Not Allowed');
4949 }
5050
51+ .. note :: The :ref:`$this->request->is() <incomingrequest-is>` method can be used since v4.3.0.
52+ In previous versions, you need to use
53+ ``if (strtolower($this->request->getMethod()) !== 'post') ``.
54+
5155When Auto-Routing is Enabled
5256----------------------------
5357
54581. Check the request method in the controller method before processing.
5559
5660E.g.::
5761
58- if (strtolower( $this->request->getMethod()) !== 'post') {
62+ if (! $this->request->is( 'post') ) {
5963 return $this->response->setStatusCode(405)->setBody('Method Not Allowed');
6064 }
6165
Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ this code and save it to your **app/Controllers/** folder:
121121
122122.. literalinclude :: validation/001.php
123123
124+ .. note :: The :ref:`$this->request->is() <incomingrequest-is>` method can be used since v4.3.0.
125+ In previous versions, you need to use
126+ ``if (strtolower($this->request->getMethod()) !== 'post') ``.
127+
124128The Routes
125129==========
126130
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class Form extends BaseController
1010
1111 public function index ()
1212 {
13- if (strtolower ( $ this ->request ->getMethod ()) !== 'post ' ) {
13+ if (! $ this ->request ->is ( 'post ' ) ) {
1414 return view ('signup ' );
1515 }
1616
You can’t perform that action at this time.
0 commit comments