NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
~~~ time:{$data.time|date='Y-m-d',###} //输出函数 用 | 后面为函数 时间函数###为占位符代表输出前面时间戳 ~~~ ## index.php文件里 ~~~ class Index extends Controller { public function index(){ $data=['name'=>'liudehua','age'=>23,'time'=>1639665430]; $this->assign('data',$data); return $this->fetch(); } } ~~~ ## view 视图里: ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div> time:{$data.time|date='Y-m-d',###} //输出函数 用 | 后面为函数 时间函数###为占位符代表输出前面时间戳 </div> </body> </html> ~~~ ## 标签过滤防止XXS攻击 ## view模板文件里 |strip_tags|htmlspecialchars //为过滤HTML标签与JS语法 ## 过滤语法: ~~~ {$data.name|strip_tags|htmlspecialchars} ~~~