取消链接对codeigniter拒绝的权限

取消链接对codeigniter拒绝的权限

本文介绍了取消链接对codeigniter拒绝的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除一个文件,在代码的输出下面,但是这个代码不能正常工作从文件目录....

How do I delete a file, Below the output of the code.. but this code is not working to del the file from the directory....

在控制器

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);

}

输出

output

严重性:公告

消息:尝试获取非对象的属性

Message: Trying to get property of non-object

文件名:controllers / C2C_contr.php

Filename: controllers/C2C_contr.php

行号:264

遇到PHP错误

严重性:通知

消息:尝试获取非对象的属性

Message: Trying to get property of non-object

文件名:controllers / C2C_contr.php

Filename: controllers/C2C_contr.php

行号:267

遇到PHP错误

严重性:警告

邮件:unlink(upload_attachments /):权限被拒绝

Message: unlink(upload_attachments/): Permission denied

文件名:controllers / C2C_contr.php

Filename: controllers/C2C_contr.php

行号:267

Array
(
    [0] => stdClass Object
        (
            [id] => 111
            [attched_files] => Untitled4.png
            [attched_remarks] =>
        )
)



推荐答案

您应该更新以下行 -

You should update below line -

取消链接('upload_attachments /'.$ del_image-> attched_files);

unlink('upload_attachments/'.$del_image->attched_files);

//使用此更新

unlink('upload_attachments /'.$ del_image [0] ['attched_files']);

unlink('upload_attachments/'.$del_image[0]['attched_files']);

这篇关于取消链接对codeigniter拒绝的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:38