繁体   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