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' ;
}