模板载入的四种方法

模板载入的四种方法

a. view()助手函数,直接调用

view()助手函数,直接调用return view();

b. 使用类元素引入与调用

$view=new \think\View([//使用完全限定名称的方法
'view_suffix'  => 'htm',
]);
return $view->fetch();

c. 引入view类,继承view类

use think\View;
class Index extends  View


$view=new \think\View([//使用完全限定名称的方法
'view_suffix'  => 'htm',
]);
return $view->fetch();

d. 引入Controller类,继承controller

use think\Controller;
class Index extends  Controller


return $this->fetch();

猜你喜欢

转载自blog.csdn.net/jaray/article/details/80649105