【问题标题】:Forbidden access to a image in database禁止访问数据库中的图像
【发布时间】:2015-06-05 08:51:15
【问题描述】:

我正在向应用发送图像的位置:http:\/\/192.168.0.193\/Symfony\/src\/OBCarsTest2Bundle\/Resources\/public\/images\/cars\/car2.jpg

她是我发送的 json 对象:

{"carInfo":
    {"name":"Mercedes",
     "model":"CLA-Class",
     "carvin":"ffgf",
     "price":"5556",
     "currency":"L.L",
     "id":2,
     "path":"http:\/\/192.168.0.193\/Symfony\/src\/OBCarsTest2Bundle\/Resources\/public\/images\/cars\/car2.jpg"}
}

但它得到一个错误:

Forbidden

You don't have permission to access /Symfony/src/OBCarsTest2Bundle/Resources/public/images/cars/car2.jpg
`on this server.`    
Apache/2.4.9 (Win64) PHP/5.5.12 Server at 192.168.0.193 Port 80

你知道如何解决这个问题吗?

有关更多详细信息,我正在使用symfony 框架。

【问题讨论】:

    标签: php apache symfony


    【解决方案1】:

    请将图像存储在web 文件夹中,而不是在bundle 中..

    【讨论】:

    • 您应该使用此命令将资产从 bundle 存储到 web 目录 php app/console assets:install web 或使用 --symlink 选项和命令以避免复制硬拷贝
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    • 1970-01-01
    • 2023-01-03
    • 2011-07-21
    • 1970-01-01
    • 2013-03-20
    相关资源
    最近更新 更多