Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用图像文件链接显示随机横幅_Php_Mysql_Url Rewriting_Http Headers_Banner - Fatal编程技术网

Php 使用图像文件链接显示随机横幅

Php 使用图像文件链接显示随机横幅,php,mysql,url-rewriting,http-headers,banner,Php,Mysql,Url Rewriting,Http Headers,Banner,我不确定这是否合适,但我正在尝试弄清楚横幅旋转器网站是如何使用标准html图像代码来返回随机横幅的 <a target=_blank href=http://intellibanners.com/click.php?cid=campaign1> <img border=0 src=http://intellibanners.com/campaign1.jpg> </a> 在上面的示例中,该html将显示来自该活动的随机图像 一开始我只是一时兴起,想看

我不确定这是否合适,但我正在尝试弄清楚横幅旋转器网站是如何使用标准html图像代码来返回随机横幅的

<a target=_blank href=http://intellibanners.com/click.php?cid=campaign1>
    <img border=0 src=http://intellibanners.com/campaign1.jpg>
</a>
在上面的示例中,该html将显示来自该活动的随机图像

一开始我只是一时兴起,想看看我是否可以设置一些类似的东西来处理不同大小的图像,但现在我快发疯了。。。试图找出如何从图像url转到数据库调用以发回不同的图像

没有幸运地寻找想法或例子,可能是因为我不知道我实际上应该寻找什么样的过程或函数

我认为所有图像调用都必须有某种url重写,重定向到处理程序脚本

该脚本进行数据库调用,从指定的活动中获取随机图像,更新统计数据等

php头响应可能会返回相应的图像文件

但其中大部分对我来说都是新的,我不确定在哪里/如何寻找指导或示例来让我开始

如果有人对此有任何想法,或者甚至是我需要的那种措辞/功能,可以帮助我在自己的搜索中达到目的,我将不胜感激

我还安装并测试了大约12个不同的rotator脚本,希望找到一个工作原理相同的,但也没有运气

谢谢


Matt

我编写了一个php脚本,该脚本假定您的网站根目录中存在所需的文件夹。然后,您可以在网站的任何位置以简单的方式调用它。这是我的剧本:

rotate.php

其他类似的:

<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign2">
    <img border="0" src="/<?php echo rotate('campaign2'); ?>">
</a>
活动2:

再见,并将所有内容测试到您的本地主机网站。。。对我来说,在PHP7.4.5和Apache2.4.43上运行良好

脚本将完成其余的工作


希望这对你有帮助

见我的答案。希望这有帮助…如果你不想重命名你的横幅图像,你可以使用原始名称,我的脚本将以任何方式工作…如果你觉得我的答案有用,请不要忘记将我的答案标记为已接受。谢谢,谢谢亚历山德罗,但是标准横幅旋转器不是我想要的。我希望使用一个横幅/链接组合数据库,这些组合在多个第三方网站上通过完全相同的代码片段进行旋转。我提到的网站正在这样做,但我不明白如何。。。我可以看到横幅url如何重写/重定向到从该url检索随机横幅的页面,但我很好奇如何将正确的图像发送到浏览器。。。如果用户单击,处理程序脚本click.php如何知道显示了哪个横幅,以便可以重定向到正确的url。
<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign1">
    <img border="0" src="/<?php echo rotate('campaign1'); ?>">
</a>
<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign2">
    <img border="0" src="/<?php echo rotate('campaign2'); ?>">
</a>
<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign1">
    <img border="0" src="/campaign1/002.jpg">
</a>

<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign1">
    <img border="0" src="/campaign1/007.jpg">
</a>
<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign2">
    <img border="0" src="/campaign2/004.png">
</a>

<a target="_blank" href="http://intellibanners.com/click.php?cid=campaign2">
    <img border="0" src="/campaign2/005.gif">
</a>