<?php
namespace app\index\controller;
use think\Controller;
use think\View;
class Index extends Controller
{
public function index()
{
//四种方法向页面赋值
$this->assign('key','value');
$this->view->key2 = 'value2';
View::share('key3','value3'); //【先usethink\View】
return $this->fetch('index',['email'=>'12356@qq.com']);
}
}
模板替换
public function index()
{
return $this->fetch('index',['email'=>'12356@qq.com'],['STATIC' => 'Hello word']);
}
__URL__
__STATIC__ /static [public/static]
__JS__ /static/js
__CSS__ /static/css