Yii获取get post参数

获取提交参数的值:

$first_word = Yii::app()->request->getParam('first_word');
if(isset($first_word) && !empty($first_word))
{
    $star['first_word'] = $first_word;
}

判断提交方式:

$request = Yii::app()->request->isPostRequest; 
$request = Yii::app()->request->isAjaxRequest;

Yii::$app->request->post("name", "null") null是默认值的意思

Yii::$app->request->csrfToken 可以帮助我们生产token 每次生产不一样

猜你喜欢

转载自blog.csdn.net/weixin_33796205/article/details/86782931