簡體   English   中英

php無法看到圖片

[英]php can't see pictures

這是我的PHP:

     <html>
 <head>
</head>
<body>
<?php 
include ('source\visuose\navigation.php');`enter code here`
include('source\visuose\social.php')
?>
</body>
 </html>

導航:

    <html xmlns="http://www.w3.org/1999/xhtml", lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/style.css" />

社會:

<body>



  <div id="facebook"> 
   <a href="http://www.facebook.com" target="_blank">
   <img src="../../images/facebook-logo.jpg" width="81" height="36" />
     </a>

   </div><!--facebook ends-->




</body>
</html>

為什么,在運行php時我看不到圖片? 只有一個空白框,但我可以按下它們去我的href?

沒有看到你的文件結構就無法確定,但這就是它的樣子;

你的“主”php在服務器根目錄/main.php ,包括source\\visuose\\social.php 由於包含 social.php,瀏覽器認為它是/main.php的一部分。

social.php給瀏覽器一個相對路徑../../images/facebook-logo.jpg ,但由於瀏覽器認為它是包含它的/main.php ,它將相對於該文件導航,而不是source\\visuose\\social.php 當瀏覽器導航您的相對路徑時,它指向沒有用的東西。

您還應該檢查生成的頁面的來源,現在您有多個html和body標簽以奇怪的方式相互包裝。

它必須與圖像的路徑有關。 在firefox中你只需要右鍵單擊圖像並選擇顯示圖像。 要查看它指向的位置(也就是來自)並檢查圖像的預期URL是什么?

然后相應地修復您的圖像路徑。

這不是PHP問題修復圖像的src

    <img src="../../images/facebook-logo.jpg" width="81" height="36" />

它會起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM