php - 服务器端包括破碎的图片

when I add an include to my header, i get broken photos.

example:

enter image description here

my code:

<?php virtual('includes/nav.php'); ?>

is there a problem in my code?

html:

<ul>
  <li><a href="#">HOME</a> </li>
  <li><a href="#">PLAY</a> </li>
  <li><a href="#">ABOUT</a></li>
  <li><a href="http://fb.com/officialninjaa"><img src="../images/facebook.png" width="60" height="17" /></a></li>
  <li><a href="http://twitter.com/martinshamasha"><img src="../images/twitter.png" width="64" height="17" /></a></li>
</ul>

Try changing the source of the image to the root

/images/facebook.png

virtual() performs an Apache sub-request, which causes URLs to be relative to the directory of the resource being accessed by that sub-request. So here:

<img src="../images/facebook.png" width="60" height="17" />

Since virtual() is executing 'includes/nav.php', the image's src attribute is pointing to 'images/facebook.png' relative to the original URL (not '../images/facebook.png').

To avoid confusion like this, try using absolute URLs instead of relative URLs:

<img src="/docroot/path/to/images/facebook.png" width="60" height="17" />

For your reference here is the official documentation on this function: virtual()