PHP随机轮流显示图片广告

效果:可以随机显示其中的代码,从而节约广告位。

代码如下:

<?php
$show_ad = array
(
'<a href=http://429006.com/ target="_top"><img alt="Lunarpages answers the phone when you call them!" src="http://abc.com/images/top-02.jpg" border="0" height="60" width="480"></a>',
'<a href=http://429006.com/ target="_top"><img alt="Lunarpages answers the phone when you call them!" src="http://abc.com/images/top-03.jpg" border="0" height="60" width="480"></a>',
'<a href=http://429006.com/ target="_top"><img alt="Lunarpages answers the phone when you call them!" src="http://abc.com/images/top-04.jpg" border="0" height="60" width="480"></a>'
);
shuffle($show_ad);
echo $show_ad[0];
?>

也可以将其中的修改其中的
<a href=http://429006.com/ target="_top"><img alt="Lunarpages answers the phone when you call them!" src="http://abc.com/top-02.jpg" border="0" height="60" width="480"></a>

替换成你的广告代码就可以随机显示广告了。

This entry was posted in Technology and tagged , , . Bookmark the permalink. 5,486 views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *