Does Yii2 have an abstraction for $_REQUEST
? I don't seem to find it, so maybe there is a reason for not having it?
Maybe I have to figure it out manually by just using Yii::$app->request->get()
and Yii::$app->request->post()
?
Does Yii2 have an abstraction for $_REQUEST
? I don't seem to find it, so maybe there is a reason for not having it?
Maybe I have to figure it out manually by just using Yii::$app->request->get()
and Yii::$app->request->post()
?
Yii1 had it, in Yii2 it's gone.
You could just mimic old behavior with a adapted Request class though:
class Request extends \yii\web\Request {
/**
* for compatibility with yii1 request->getParam()
*/
public function getParam($name, $defaultValue = NULL) {
return isset($_GET[$name]) ? $_GET[$name] : (isset($_POST[$name]) ? $_POST[$name] : $defaultValue);
}
}
You need to override the request application component setting to use your own class then.