本站点已停止更新,内容已迁移至 lh1010.com
good luck to you

ThinkPHP 常用知识点

文章目录

分页

分页 paginate 获取数据后,对对象添加数据(5.0、5.1):

$orders = Db::name('order')->paginate()->each(function($value, $key) use ($snap) {
    $value['additional_str'] = 'additional_string';
    if ($snap == 1) $value['snaps'] = 'this is test string';
    return $value;
});

模板分页含参数:

$query->paginate(['query' => Request()->param()]);
$query->paginate(12, false, ['query' => Request()->param()]);
$query->paginate(12, false, ['query' => ['demo' => $demo, 'demo2' => 'demo2']]);

模板截取字符串

# version 5.1
{{$vo.description|mb_substr=0,30,'utf-8'}}
{{$vo.create_time|substr=0,10}}
原文链接:,转发请注明来源!

发表评论