简体   繁体   English

php无法看到图片

[英]php can't see pictures

This is my php: 这是我的PHP:

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

Navigation: 导航:

    <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" />

Social: 社会:

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

Why, when running php I can't see pictures? 为什么,在运行php时我看不到图片? There is only a blank box, but I can press on them and go to my a href? 只有一个空白框,但我可以按下它们去我的href?

Can't be sure without seeing your file structure, but this is what it looks like; 没有看到你的文件结构就无法确定,但这就是它的样子;

Your "main" php is in the server root /main.php and includes source\\visuose\\social.php . 你的“主”php在服务器根目录/main.php ,包括source\\visuose\\social.php Since social.php is included , the browser thinks it's a part of /main.php . 由于包含 social.php,浏览器认为它是/main.php的一部分。

social.php gives the browser a relative path ../../images/facebook-logo.jpg , but since the browser thinks it's /main.php including it, it will navigate relative from that file, not source\\visuose\\social.php . social.php给浏览器一个相对路径../../images/facebook-logo.jpg ,但由于浏览器认为它是包含它的/main.php ,它将相对于该文件导航,而不是source\\visuose\\social.php When the browser navigates your relative path, it points to nothing useful. 当浏览器导航您的相对路径时,它指向没有用的东西。

You should also inspect the source of the generated page, right now you have multiple html and body tags wrapping each other in a strange way. 您还应该检查生成的页面的来源,现在您有多个html和body标签以奇怪的方式相互包装。

it has to be issue with the path of the image. 它必须与图像的路径有关。 In firefox You just need to right click the images and select show image. 在firefox中你只需要右键单击图像并选择显示图像。 To see where it is pointing ( aka coming from ) and check for what is the intended URL for the image ? 要查看它指向的位置(也就是来自)并检查图像的预期URL是什么?

And then repair your images path accordingly. 然后相应地修复您的图像路径。

This is not a PHP issue fix the src of your image 这不是PHP问题修复图像的src

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

and it would work 它会起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM