您的位置:首页 > 编程语言 > PHP开发

yii接值方式判断以及获取当前用户ip

2017-02-08 17:03 295 查看
public function actionDemo(){
$req=\YII::$app->request;
echo $req->get('id');//以get方式接值
echo $req->post("name",3333); //以post方式接值
if($req->isPost){//判断接值方式为post返回true
echo 'this is post method';
}
if($req->isGet){//判断接值方式为get返回true
echo 'this is get method';
}
echo $req->userIp;//输出当前IP
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  yii