2017-06-15 3 views
0

私はPHPを使用してウェブサイトを構築しています。写真が示すとおり、最初はすべてhtmlcssjsで終了しました。HTMLをPHPに変換した後にCSSの背景画像が表示されない

次に、htmlphpに変換し始めます。

ただし、htmlからphpに変換した場合、cssの背景画像は失敗します。 パスを確認しましたが、htmlで動作します。

my files

私はコードと間違って何見当がつかない。

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の3つは失敗します。

+5

関連コードを掲載できますか? –

+0

HTMLをPHPに変換するとはどういう意味ですか? HTMLはタグの外のPHPファイルに入れることができます。 – ottiem

+0

すべてのファイル "index.html to index.php"を検索して置き換えます。 PHPでHTMLファイルを変更するときに行うべきことは何もありません。 あなたのCSSに間違ったパスがあると思います。コード全体を提供できますか? –

答えて

0

最後に問題が解決しました!それは私に一夜を要しました!htmlをPHPに変更するのは初めてです。とても興奮しています!ありがとうございました!私は祈って解決しました!

実際には、写真が保護されているからといって、読めるようになっています。それだけです!

関連する問題