接口调用,字符串截取处理。
程序员文章站
2022-04-02 18:09:24
...
public function index(){
$this->assign('title','index');
/*平台公告*/
$curl=new CurlController();
$data=array(
'CmdId'=>'NewsList',
'Token'=>'',
'PostDetails'=>json_encode(array(
'nid'=>'gonggao',
'page'=>1,
'listRows'=>'5',
)));
$re=$curl->SendCurl($data);
if ($re['RespCode'] === '000'){
$re=$re['AcctDetails'];
foreach($re as $key=>$value){
$re[$key]['publish']=substr($re[$key]['publish'],0,10);
$re[$key]['name']=mb_substr($re[$key]['name'],0,17,'utf-8');
}
//var_dump($re);
$this->assign('news',$re);
$this->assign('nid',$nid);
$this->assign('id',$id);
}
上一篇: 内存泄漏是什么以及如何解决
下一篇: 生成指定个数的随机红包