//删除备份数据
public function unLinkDate()
{
$session = $_SESSION['userName'];
if(empty($session)) $this->ajaxReturn('','未登录!',-1);
$id = $this->_post('id');
$db = M('datapath');
$where['id'] = $id;
$result = $db->where($where)->select();
if($result){
$data_Path = $result[0]['path'];
$filename = $result[0]['filename'];
$file_Path = $data_Path.$filename;
if(file_exists($file_Path)){
$res = $db->where($where)->delete();
if($res){
if(!unlink($file_Path)) $this->ajaxReturn('','删除失败!',-2);
$this->ajaxReturn('','删除成功!',1);
}else{
$this->ajaxReturn('','删除失败!',-3);
}
}else{
$this->ajaxReturn('','文件不存在!',-4);
}
}else{
$this->ajaxReturn('','没有此数据!',-5);
}
}
public function unLinkDate()
{
$session = $_SESSION['userName'];
if(empty($session)) $this->ajaxReturn('','未登录!',-1);
$id = $this->_post('id');
$db = M('datapath');
$where['id'] = $id;
$result = $db->where($where)->select();
if($result){
$data_Path = $result[0]['path'];
$filename = $result[0]['filename'];
$file_Path = $data_Path.$filename;
if(file_exists($file_Path)){
$res = $db->where($where)->delete();
if($res){
if(!unlink($file_Path)) $this->ajaxReturn('','删除失败!',-2);
$this->ajaxReturn('','删除成功!',1);
}else{
$this->ajaxReturn('','删除失败!',-3);
}
}else{
$this->ajaxReturn('','文件不存在!',-4);
}
}else{
$this->ajaxReturn('','没有此数据!',-5);
}
}