这只是一个demo 第一步:使用php的ob缓存实现页面静态化 控制器方法: <?php namespace app\test\controller; use app\test\model\DetailModel; use think\Db; class Detail extends Base { public function index() { $id = input('param.id'); $fileName='./html/'.$id.'.html'; $model = new Det
有业务需求如下: select * from table where id IN (3,6,9,1,2,5,8,7) order by field(id,3,6,9,1,2,5,8,7); 这里直入主题,用TP的order方法写的话,可能不太好写,但是也可以写成这样 ->order("field(id,3,6,9,1,2,5,8,7)") 但是官方文档说了,当你的order排序中使用了SQL函数的时候,请使用orderRaw方法替代order 所以并不太好实现. 所以查阅资料找到