api接口自定义模板,sql作为条件查询
{php $db = \Phpcmf\Service::M()->db;}
{table table=1_form_zwjhfb status=1 order=inputtime}
{php $api[$key]['id']=$t['id'];}
{php $api[$key]['title']=$t['title'];}
{php $api[$key]['xyzw']=$t['xyzw'];}
{php $api[$key]['xyrs'] = $db->table('dr_1_form_zwjhxxb')->where('bsqzw_id',$t['id'])->count() ?: 0;}
{php $api[$key]['inputtime']=dr_date($t['inputtime'], 'Y-m-d H:i');}
{/table}
这个是自定义模板标签,这里报错了。通过一张表里字段作为条件去查询另一张表的数量
{php $api[$key]['xyrs'] = $db->table('dr_1_form_zwjhxxb')->where('bsqzw_id',$t['id'])->count() ?: 0;}
