Category:PHPthinkphp5
Article From:https://www.cnblogs.com/zhangyouwu/p/9125112.html
$data = $this->request->param();//$data='1,2,3,4,'
$plist=rtrim($data['plist'], ",");//$plist='1,2,3,4'
$str=explode(",",$plist); //$strFor an array separated by a comma

foreach ($str as $key => $val) {
model(
'Imgfile')->insert(['url'=>json_encode($val)]); //tp5The SQL statement
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *