Php 对codeigniter的取消链接权限被拒绝
如何删除代码输出下方的文件。。但此代码无法从目录中删除文件 在控制器中Php 对codeigniter的取消链接权限被拒绝,php,codeigniter,permissions,unlink,Php,Codeigniter,Permissions,Unlink,如何删除代码输出下方的文件。。但此代码无法从目录中删除文件 在控制器中 public function delete_by_id() { $id = $this->uri->segment(3); $schemeid = $this->uri->segment(4); $link = $this->uri->segment(5); $tablename = $this->uri->s
public function delete_by_id()
{
$id = $this->uri->segment(3);
$schemeid = $this->uri->segment(4);
$link = $this->uri->segment(5);
$tablename = $this->uri->segment(6);
//unlink code ------------------------------------------>
$del_image = $this->C_model->getrecordwhere($tablename, array('id' => $id));
unlink('upload_attachments/'.$del_image->attched_files);
echo '<pre>';print_r($del_image);die;
// if($tablename== 'progress')
// {
$where = array('id'=>$id);
//$where = array('id'=>$id);
//$where = array('id'=>$id);
//$where = array('id'=>$id);
$this->C_model->deleteid($tablename,$where);
redirect('C2C_contr/'.$link.'/'.$schemeid);
}
您应该更新以下行- 取消链接('upload_attachments/'.$del_image->attched_files) //更新此
取消链接('upload_attachments/'.$del_image[0]['attched_files']) 你在构造函数中加载了这个C_模型了吗?公共函数uu-construct(){parent::u-construct();$this->load->model('C_-model');}我已经在构造函数文件中加载了这个模型,它们是从表中删除的,而不是从目录路径中删除的使用$del_-image[0]替换$del_图像,然后尝试它。
Array
(
[0] => stdClass Object
(
[id] => 111
[attched_files] => Untitled4.png
[attched_remarks] =>
)
)