这是我的控制器:
public function doDelete($id_jeans)
{
$where = array("id_jeans" => $id_jeans);
$res = $this->admin_model->DeleteData('jeans', $where);
}
这是我的模特:
public function DeleteData($tabelname, $where)
{
if ($this->db->delete($tabelname, $where)) {
redirect("admin/admin/index");
}else {
echo "tidak berhasil";
}
$res = $this->db->delete($tabelname, $where);
return $res;
}
如何使用CodeIgniter删除图像?
答案 0 :(得分:0)
您只是从表中删除数据。如果要从目录中删除文件:
public function DeleteData($tabelname, $where, $path_to_file)
{
if ($res = $this->db->delete($tabelname, $where)) {
unlink($path_to_file);
redirect("admin/admin/index");
}else {
echo "tidak berhasil";
}
}