Home >Backend Development >PHP Tutorial >求救。php处理 批量删除图片

求救。php处理 批量删除图片

WBOY
WBOYOriginal
2016-06-23 13:25:31995browse

用的是checkbox批量传递的ID信息 然后批量删除ID

foreach($_POST['id'] as $k=>$id){$id=intval($id);DB::query("DELETE FROM ".DB::table('abc')." WHERE id='$id' LIMIT 1 ");


每个信息ID里面 字段pic 是图片地址, 那么怎么处理同步删除图片呢?下面方法使用了,但是不行
$result = DB::query("SELECT * FROM ".DB::table('abc')." where id='$id' and pic!=NULL LIMIT 1 ");		$rows = mysql_fetch_assoc($result);		@unlink($rows[pic]);


回复讨论(解决方案)

信息可以删除了,但是图片删除不掉

SELECT pic FROM ".DB::table('abc')." where id='$id'

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn