public function del_invalid_pic() { if ($_POST['order_type'] == 0) { $pic_filepath = 'group'; } else { $pic_filepath = 'meal'; } $database_reply_pic = D('Reply_pic'); $condition_reply_pic['uid'] = $this->user_session['uid']; $condition_reply_pic['order_type'] = $_POST['order_type']; $condition_reply_pic['order_id'] = $_POST['order_id']; $reply_pic_list = $database_reply_pic->field('`pic`')->where($condition_reply_pic)->select(); if ($reply_pic_list) { $reply_image_class = new reply_image(); foreach ($reply_pic_list as $value) { $reply_image_class->del_image_by_path($value['pic'], $pic_filepath); } $database_reply_pic->where($condition_reply_pic)->delete(); } }