tp6获取参数的五种办法

Posted aln0825

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tp6获取参数的五种办法相关的知识,希望对你有一定的参考价值。

1 继承BaseController

2 引入appRequest 使用依赖注入的方式 $request->param()

3 助手函数 Input()

4 使用  request()->param() 方法

5 使用thinkfacadeRequest  静态方法

<?php
namespace appcontroller;
use appBaseController;
use appRequest;
use thinkfacadeRequest as ABC;
class Learn extends BaseController
{

    public function  index(Request $request)
    {
       $data =  $request->param();
        dump($data);
        dump(input(‘get.‘));
        dump(ABC::param());
        dump(request()->param());
    }
}

  

以上是关于tp6获取参数的五种办法的主要内容,如果未能解决你的问题,请参考以下文章