欢迎来到 54818模板网!这是一个yzmcms的模板分享站。

delete_attachment

相关案例演示

/**(V6.3 新增)
 * 删除内容附件
 * @param   $modelid 
 * @param   $id  
 */
function delete_attachment($modelid, $id){
	if(!get_config('att_relation_content')) return false;
	$attachment = D('attachment');
	$upload_type = C('upload_type', 'host');
	yzm_base::load_model($upload_type, 'attachment', 0);
	if(!class_exists($upload_type)) return false;
	$res = $attachment->field('id,filepath,filename')->where(array('contentid'=>$modelid.'_'.$id))->select();
	$upload = new $upload_type();
	foreach($res as $val){
		$res = $upload->deletefile($val);
		if(!$res)  continue;
		$attachment->delete(array('id' => $val['id']));
	}
	return true;
}

    上一篇:update_attachment

    下一篇:get_siteid

    作者:54818模板网 关注:649 时间:2022-01-24 00:01:21
    相关网站教程