author:咔咔
wechat:fangkangfk
案例:在有的地方添加图片时,会出现添加多条的情况,添加格式如下,我们进行处理一下
这是一个公共方法。是使用了str_replace的方法来处理的
public function trimall($str)//删除空格 { $oldchar=array(" "," ","\t","\n","\r"); $newchar=array("","","","",""); return str_replace($oldchar,$newchar,$str); } $appsList = $this->appsModel->select()->toArray(); $a = $appsList[0]['a_images']; $c = $this->trimall($a); $b = explode(',',$c); dump($b);die;