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');   //助手函數
    }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM