【问题标题】:Images not loading in CodeIgniter, image path correct error 403图像未在 CodeIgniter 中加载,图像路径正确错误 403
【发布时间】:2021-09-08 11:51:58
【问题描述】:

我有一个应用程序,我将图像路径保存在数据库中。我有一个方法上传

function uploads($path) 
{
    echo base_url('application/uploads/'.$path);   
    return true;
}

//base url 是 $config['base_url'] = 'https://localhost/salon';

$path 取自图片

 style="background-image: url(<?php uploads('gallery/'.$gImage['imgPath']);?>)"

这就是我设置背景图像的方式。

当我尝试打开图像时,我得到的错误是 403 禁止访问。

我也尝试过回显 src,这就是我得到的 https://prnt.sc/16ofw1m

我不知道末尾的 1 来自哪里,但在 src 中,如检查元素中所见,没有 1 https://prnt.sc/16ogce3

【问题讨论】:

  • 一般图片会上传到assets文件夹,你可以轻松访问assets文件夹

标签: php html css


【解决方案1】:

问题出在我的 htaccess 文件中,我只是注释掉了这行>

#<IfModule authz_core_module>
#    Require all denied
#</IfModule>
#<IfModule !authz_core_module>
#    Deny from all
#</IfModule>

我花了一段时间才注意到他们在那里。

【讨论】:

    猜你喜欢
    • 2014-01-09
    • 1970-01-01
    • 2015-11-13
    • 2017-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-23
    相关资源
    最近更新 更多