迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架, 基于MIT开源许可协议发布,不限制商业使用,以多端互联为设计理念, 支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
API接口使用模板标签,无缩略图 ,请问如何回调出文章缩略图和所属栏目名称,
下图使用模板标签:{module module=news catid=4}调用
返回数据没有缩略图项:
$return = []; // 返回数据 // 查询新闻列表 $data = \Phpcmf\Service::M()->table('1_news')->where("catid", "4")->getAll(); if ($data) { foreach ($data as $r) { $return[] = [ 'title' => $r['title'], 'thumb' => dr_thumb($r['thumb'], 345, 176), 'description' => $r['description'], 'catname' => dr_cat_value($r['news'], $t.catid, 'name'), ]; } }
'catname' => dr_cat_value('news', $t['catid'], 'name'),
把数字转换为图片地址
$return = []; // 返回数据 // 查询新闻列表 $data = \Phpcmf\Service::M()->table('1_news')->where("catid", "4")->getAll(); if ($data) { foreach ($data as $r) { $return[] = [ 'title' => $r['title'], 'thumb' => dr_thumb($r['thumb'], 345, 176), 'description' => $r['description'], 'catname' => dr_cat_value($r['news'], $t.catid, 'name'), ]; } }这样写catname为空,应该怎么写呢'catname' => dr_cat_value('news', $t['catid'], 'name'),