命令行生成控制器

php think make:controller index/User

渲染模板

use think\View;

$view = new View();
$view->assign('name','huyongjian');
return $view->fetch('index');

初始化方法

public function _initialize()
    {
        echo 'init<br/>';
    }

成功和错误跳转

$this->success('新增成功', 'create');
$this->error('新增失败');

空操作

public function _empty($name)
{
    echo 'empty:'.$name;
}

空控制器

<?php
namespace app\index\controller;

use think\Request;

class Error
{
    public function index(Request $request)
    {
        echo 'error controller: '.$request->controller();
    }

}

相关文章:

  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
猜你喜欢
  • 2021-12-02
  • 2021-05-21
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案