将HTML转换为PHP后CSS背景图像失败

将HTML转换为PHP后CSS背景图像失败,php,css,Php,Css,我正在用PHP建立一个网站。我首先完成了所有的html,css,js,如图所示 然后我开始将html转换为php 但是,在将html转换为php后,css中的背景图像将失败。 我已经检查了路径,它在html中工作 我不知道代码出了什么问题 当我将html转换为PHP时,需要对CSS进行任何特殊操作吗 body { background: url('../img/bg3.jpg') center; position: relative; height:1300px; }

我正在用PHP建立一个网站。我首先完成了所有的
html
css
js
,如图所示

然后我开始将
html
转换为
php

但是,在将
html
转换为
php
后,
css
中的背景图像将失败。 我已经检查了路径,它在html中工作

我不知道代码出了什么问题

当我将html转换为PHP时,需要对CSS进行任何特殊操作吗

body {
    background: url('../img/bg3.jpg') center;
    position: relative;
    height:1300px;
}

#wrapper{  height:1500px;}

#wrapper{overflow: hidden;}
.wrapper-head {
    background: black url('../img/head.jpg') center no-repeat;
    margin: 0 auto;
    width: 908px;
    height: 178px;
    margin-top: 39px;
    margin-bottom: 0px;
    box-shadow: -2px 0 20px 1px #7f7e7f, 0 -2px 20px 1px #7f7e7f, 2px 0 20px 1px #7f7e7f;
    border-bottom: solid 1px #ff0000;
    position: relative;
}

.wrapper-head img {
    float: right;
    position: relative;
}

.wrapper-nav {
    background: url('../img/nav.jpg') center no-repeat;
    width: 1009px;
    height: 83px;
    margin: 0 auto;
    margin-top: 0px;
    -ms-transform: translate(0px, -33px);
    /* IE 9 */
    -webkit-transform: translate(0px, -33px);
    /* Safari */
    transform: translate(0px, -33px);
    /* Standard syntax */
    margin-bottom: 0px;[![enter image description here][2]][2]
    color: #281d04;
}
整个道路是:

/Applications/XAMPP/xamppfiles/htdocs/myblog/petshop/public
特别的是,当我打开这条路径时:

http://localhost/petshop/public/img/bg3.jpg
它说:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Apache/2.4.23 (Unix) OpenSSL/1.0.2h PHP/7.0.9 mod_perl/2.0.8-dev Perl/v5.16.3

同一文件夹中html中使用的其他照片可以工作,只有css中的三张照片失败。

最后我解决了这个问题!我花了一个晚上!这是我第一次将html转换成php,非常激动!感谢上帝!我祈祷,然后解决了


事实上,这很简单,因为照片受到保护,我让它们可读。就是这样

你能发布相关代码吗?将HTML转换为PHP是什么意思?HTML可以放在标签外的PHP文件中。可能是您的PHP文件与HTML文件位于不同的位置吗?搜索并替换所有文件“index.HTML to index.PHP”。在PHP中更改HTML文件时,无需执行其他操作。我猜你的css中有一条错误的路径。你能提供你的全部代码吗?是的,我只是发布css代码和路径。