gpt4 book ai didi

php - 为什么这个错误发生在 codeigniter fileupload 上?

转载 作者:行者123 更新时间:2023-11-30 08:13:32 25 4
gpt4 key购买 nike

这是我的上传功能

public function do_upload()
{
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'gif|jpg|png';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload('customer_photo'))
{
$responce->success = false;
$responce->data['error'] = $this->upload->display_errors();
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->_do_resize($data);
}
echo json_encode($responce);
}

这是我在 firebug 控制台上看到的 json

{"success":false,"data":{"error":"<p>The filetype you are attempting to upload is not allowed.&lt;\/p&gt;"}}</p>

知道为什么它包含 </p>还有这些&lt;\/p&gt;

问候

最佳答案

根据manual , $this->upload->display_errors()将错误消息包装在 <p> 中标签。

您可以为分隔符传递参数,以将错误包装在您想要的内容中。

$this->upload->display_errors('', '');

关于php - 为什么这个错误发生在 codeigniter fileupload 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7153643/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com