search

Home  >  Q&A  >  body text

Can't get any

Website: http://localhost/thinkphp/public/index/Be/demo1/name/think

—————————————————— ——————————

namespace app\index\controller;

class Be extends \think\Controller
{

protected $beforeActionList = [
                                //                                                                                                                                                         to                              . ##       //'before3'=>['except'=>'demo3,demo1'],
    ];

            protected $siteName;

          //Write here Pre-method
protected function before1()
{
$this->siteName =$this->request->param('name');
}

protected function before2()
{
$this->siteName = 'Baidu Chinese Network 2';
}

protected function before3()
{
$ this->siteName = 'NetEase 3';
}


public function demo1()
{
  return $this->siteName;
}

public function demo2()
{
return $this->siteName;
}

public function demo3()
{
return 'ss3' ;
}

helooheloo2491 days ago1368

reply all(2)I'll reply

  • 韦小宝

    韦小宝2018-01-30 09:16:56

    Where do you want to get the method from?

    reply
    0
  • heloo

    url_param_type' => 0, please modify it

    heloo · 2018-01-30 09:45:00
  • Cancelreply