zoukankan      html  css  js  c++  java
  • 视图层View

    视图view

    第一种方法【助手函数】
      return view();
      传递第一个参数,修改模板文件目录
      return view('index');
      return view('upload');
      return view('public/upload');
      return view('./index.html');
      return view('./index/index.html');【这种情况加.html】

      传递第二个参数,传递给页面的值{$email}{$user}方式获取
      return view('index',['email'=>'12365@qq.com','user'=>'kaluo']);

      传递第三个参数,将页面中所有的STATIC替换问自定义内容
      return view('index',['email'=>'12365@qq.com','user'=>'kaluo'],['STATIC'=>'hello world']);

    第二种方法【Controller类】
      use think\Controller;

      class Index extends Controller
      {
        public function index()
        {
        return $this->fetch();【使用的html文件构建的模板】【由前台页面时使用】
        第一种方法:

        传递第一个参数,修改模板文件目录
        传递第二个参数,传递给页面的值{$email}{$user}方式获取
        传递第三个参数,将页面中所有的STATIC替换问自定义内容
        return $this->fetch('index',['email'=>'12365@qq.com','user'=>'kaluo'],['STATIC'=>'hello world']);

        第二种方法:

        $this->assign('assign','saaign传递的内容');
        return $this->fetch();

        第三种方法:

        $this->display();【传递一个字符串,在这个字符串里接收标准的模板编写方式,可以使用模板中的方法来进行编写】
        $this->assign('user,'kaluo');
        $this->display('{$user}是一个{$type}','type'=>'美男子');
        }
      }

  • 相关阅读:
    Unity
    Unity
    Unity
    Unity
    Unity项目
    Unity
    UnityShader
    Unity
    【数据结构与算法】链表——奇偶链表
    【数据结构与算法】链表——分隔链表
  • 原文地址:https://www.cnblogs.com/Caveolae/p/7119176.html
Copyright © 2011-2022 走看看