Index.php内容:
<?php
namespace app\index\controller;
class Index
{
public function index()
{
header("Content-type:Text/html;charset=utf-8");
$options = [
'type' => 'File', // 缓存类型为File
'expire' => 10 // 0为缓存有效期为永久有效
];
S($options);
$news = S('news');
if(!$news){
$list = M("news")->order("id DESC")->select();
S('news',$list);
$news = $list;
}
$view = new \think\View();
$view->assign('list',$news);
return $view->fetch();
}
}
模板中是这样的:
{volist name="list" id="vo"}
{$vo.id} -- {$vo.ti
{/volist}
volsit.png
( 70.45 KB 下载:13 次 )
最佳答案