tp5控制器

namespace app\index\controller;

use think\Controller;

class Index extends Controller    //继承父类
{   //public function _initialize(){
    //echo '初始化';                              //初始化

    public function index()
    {
        // $this->redirect('News/category', ['cate_id' => 2]);   //重定向到News模块的Category操作
        // return $this->fetch();   渲染模板 
        //view 下面的文件夹名称与 类的名称一样,文件名与方法名一样
        $this->success('ok','index/pro');  //成功后跳转
        // $this->redirect('index,pro');      //跳转
       
    }
    public function pro(){
        return $this->fetch();  //找到视图文件
        
   }
    // 请求
    // $request = Request::instance();
    // $request = request();  助手请求需要类
    // intput(?id;.id);助手检测变量是否存在
    // if(request()->isGet()) echo 'get' 请求类型
    // input('param.name'); 获取请求




}

posted on 2020-07-06 16:56  vermouthmo  阅读(132)  评论(0)    收藏  举报

导航