首页  >  问答  >  正文

获取不到 任何

网址:http://localhost/thinkphp/public/index/Be/demo1/name/think

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

namespace app\index\controller;

class Be extends \think\Controller
{

   protected $beforeActionList = [
       //这里是前置方法
         'before1' => '',
       // 'before2'=>['only'=>'demo2'],
       //'before3'=>['except'=>'demo3,demo1'],
   ];

     protected $siteName;

   //这里写个前置方法
   protected function before1()
   {
       $this->siteName =$this->request->param('name');
   }

   protected function before2()
   {
       $this->siteName = '百度中文网2';
   }

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


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

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

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

helooheloo2428 天前1314

全部回复(2)我来回复

  • 韦小宝

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

    你在是要从哪里获取方法的

    回复
    0
  • heloo

    url_param_type' => 0, 修改下好了

    heloo · 2018-01-30 09:45:00
  • 取消回复