联系官方销售客服
1835022288
028-61286886
回调方法定义求解,ppp_list_data是列表页的定义,ppp_piccount_data是内容页的定义,但是下面这种写法报错,请问下正确写法
<?php namespace My\Library; class Http extends \Phpcmf\Library\Http { //// 上面是系统自带的 /// 下面是自己加的+++++++++++ public function ppp_list_data($data) { $rt = []; // 这里根据项目的$data输出格式来定义PHP的数据写法, // 每个接口的写法几乎不一样,下面是测试例子 if ($data['list']) { foreach ($data['list'] as $t) { $img = []; foreach ($t['images'] as $i) { $img[] = dr_get_file($i['file']); } $keywordsArr = []; if($t['keywords']!='') { $keywordsArr = explode(',',$t['keywords']); } $rt[] = [ 'title' => $t['title'], 'id' => $t['id'], 'keywords'=>$keywordsArr, 'comments'=>$t['comments'], 'author'=>$t['author'], 'avatar'=>dr_avatar($t['uid']), 'hits'=>$t['hits'], 'favorites'=>$t['favorites'], 'support'=>$t['support'], 'thumb' => dr_thumb($t['thumb'], 200, 200), 'updatetime' => dr_date($t['_updatetime'], 'Y-m-d H:i:s'), 'images' => $img, ]; } } return $rt; } public function ppp_piccount_data($data) { $rt = []; // 这里根据项目的$data输出格式来定义PHP的数据写法, // 每个接口的写法几乎不一样,下面是测试例子 $keywordsArr = []; if($data['keywords']!='') { $keywordsArr = explode(',',$data['keywords']); } $img = []; foreach ($data['images'] as $i) { $img[] = dr_get_file($data['file']); } $list = []; if ($data['list']) { foreach ($data['list'] as $t) { $list[] = [ 'author' => $t['author'], 'content' => $t['content'], 'support'=>$t['support'], 'avatar'=>dr_avatar($t['uid']), 'inputtime' => dr_date($t['inputtime'], 'Y-m-d H:i:s'), ]; } } $rt[] = [ 'title' => $data['title'], 'id' => $data['id'], 'author'=>$data['author'], 'keywords' => $keywordsArr, 'avatar'=>dr_avatar($data['uid']), 'images' => $img, 'list' => $list, 'updatetime' => dr_date($data['_updatetime'], 'Y-m-d H:i:s'), ] return $rt; } }
插件名称:
这不是这里??