How to write this line of code from Yii to Yii 2.0:
Yii::app()->getRequest()->getRestParams()
?
How to write this line of code from Yii to Yii 2.0:
Yii::app()->getRequest()->getRestParams()
?
I believe it is
Yii::$app->request->restParams
or
Yii::$app->getRequest()->getRestParams()
and you may find the following issue interesting
In my opinion, the equivalent of
Yii::app()->getRequest()->getRestParams()
in Yii 2 is
Yii::$app->request->getBodyParams()
moreover, if you would like to know the method of the request (POST, PATCH, DELETE etc.), you can use Yii::$app->request->getMethod()
More information about the Request
class instance you can find here.
you can use it this way
Yii::$app->request->getBodyParams()
there are more similar methods, please check here https://www.yiiframework.com/doc/api/2.0/yii-web-request
see the guide article as well https://www.yiiframework.com/doc/guide/2.0/en/runtime-requests
According to Yii1 it is changed like the below.
Yii::$app->request->bodyParams;
You can see here for other details also.
http://www.yiiframework.com/doc-2.0/guide-runtime-requests.html