tp5 接收参数

<?php

namespace app\admin\controller;

use think\Controller;
use think\facade\Request;

class Demo extends Controller
{
    public function login($code = '', $nickname = '', $thumb = '', $gender = '')
    {
        //第一种判断
        if (!request()->isPost()) {
            return;
        }
        //第二种判断
        if (!$this->request->isPost()) {
            return;
        }

        $data = $this->request->post();//第二种接受参数
        $data = input('post.');//第三种接受参数

        //还有两种。。。
        $code = Request::param('code');   //Facade机制调用
        $code = request()->param('code');   //助手函数
    }
}
posted @ 2020-07-08 10:05  王玉岩  阅读(1065)  评论(0编辑  收藏  举报