Home > php教程 > php手册 > 如何在百度贴吧里加入带链接的广告图片

如何在百度贴吧里加入带链接的广告图片

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:38:23
Original
1193 people have browsed it

  帮客之家(www.Bkjia.com)教程 今天在百度贴吧看到了一帖子,点击里面的图片就会进入自己的设定好的链接。貌似不太可能,因为百度只允许你填入一个图片链接,不允许图片自己加链接了。其实,通过PHP 判断一下是不是被图片引用,还是在查看就好了,代码如下:

以下为引用的内容:
$fileLine = file(dirname(__FILE__) . "/file.ini");
$nameMap = array();
foreach ($fileLine as $item) {
$item = explode(" ", $item);
if (count($item) == 3) {
$nameMap[$item[0]] = array($item[1], $item[2]);
}
}

$name = $_GET['name'];
if (!isset($nameMap[$name])) {
exit(0);
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
if (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], "baidu") !== false) {
header("Content-Type: image/png");
echo get($nameMap[$name][0]);
} else {
header("location:" . $nameMap[$name][1]);
exit(0);
}

  File.ini 这样配置:

以下为引用的内容:
mysql.jpg http://www.bkjia.com/bkjia.com/images/liehuo2009/logo.gif http://www.bkjia.com/
lyf.jpg http://www.bkjia.com/uploads/allimg/090904/1231133495-0-lp.jpg http://www.bkjia.com/

  调用这样调用:

  http://yourhost/image.php?name=lyf.jpg

  这个图片就可以实现贴吧里面的功能了。很简单,但是非常有创意。不过,这个方法再Firefox 下不可以!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template