0

我有一个小问题。我不擅长 php,所以这可能很简单。基本上,我有几个网站,我想在它们上实现一个特定的图片。我希望通过一个脚本来控制它(连同一个超链接)。所以我所做的是:

   <?php include 'http://content.captive-portal.com/pd/sponsored/sponsored.php' ?>

我已将此代码放在几个网站上,但它没有显示图片。为什么?可以这样做吗?我放置此脚本的页面是: amc 链接- 图像应出现在徽标下方。上面脚本中的 gif 图像。谁能帮我解决这个问题?我做错了什么?做不到吗?感谢您的帮助。

代码在这里:

<div id="wrapper">
        <img id="logo" src="images/logotop_m.jpg"/>
        <?php include 'http://content.captive-portal.com/pd/sponsored/sponsored.php' ?>
</div> <!--eo wrapper -->

...
4

2 回答 2

0

Is the relative path causing the issue? Does the sponsored.php file make reference to the image using a complete path? (e.g.... http://content.captive-portal.com/images/.... or just images/...)

于 2013-01-04T12:08:20.757 回答
0

The reason for that is that some images are being used via relative links. Here's the logo:

<img id="logo" src="images/logotop_m.jpg"/>

As it isn't an absolute path with a domain, it'll resolve as the following:

http://yourdomain.com/images/logotop_m.jpg

Instead of what you're expecting:

http://amc.captive-portal.com/images/logotop_m.jpg

Edit: Oops

I didn't notice the redirect as I opened it in a new tab - my bad. The php file itself contains this:

<p><a href="http://bit.ly/VzF7ds"><img src="http://content.captive-portal.com/pd/sponsored/sponsored.gif" width="480" height="80"></a></p>

As it's an absolute path, it *should* be alright.

于 2013-01-04T12:09:16.033 回答