首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在运行php旋转脚本时遇到问题

问在运行php旋转脚本时遇到问题
EN

Stack Overflow用户
提问于 2013-07-05 15:23:42
回答 2查看 95关注 0票数 1

首先,如果这个问题非常基本/多余,很抱歉。我没有php经验,也几乎没有编程经验。

基本上,我要做的就是利用这里提供的一个循环脚本:

http://www.jim.am/rotating-offer-pages-and-landing-pages-in-prosper202/

我遵循了网站上的说明,它们真的很简单-因为我所需要做的就是把他的链接换成我的。

然而,当我点击我的"rotate.php?kw=“链接时,它只会跳转到一个显然只是一个空白页面的页面。由于某些原因,旋转脚本似乎无法正常工作。

所以我只希望更熟悉php的人能浏览一下代码(在上面的链接中)。它只有15行代码...

谢谢!

编辑:

这是我尝试轮换的链接:

http://test.p2track.com/rotate.php?kw=test123

我的代码如下:

代码语言:javascript
复制
<?php
if ($_GET['kw']) {
$kw = strip_tags($_GET['kw']);
} else { $kw = ‘jimrocks’; }
$landingpages = array(
// paste as many tracking links as you like below
// copy and paste the whole line and put the link between the ‘ and the ‘
‘http://be2canada.struenet.com/RuleLP/?t202id=3109&t202kw=’.$kw,
‘http://be2canada.struenet.com/RegLP/?t202id=8115&t202kw='.$kw,
);
$searchlink = $landingpages[array_rand($landingpages)];
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: $searchlink”);
exit();
?>

OK -我的新代码:

代码语言:javascript
复制
<?php
if ($_GET['kw']) {
$kw = strip_tags($_GET['kw']);
} else { $kw = ‘jimrocks’; }
$landingpages = array(
// paste as many tracking links as you like below
// copy and paste the whole line and put the link between the ‘ and the ‘
'http://be2canada.struenet.com/RuleLP/?t202id=3109&t202kw='.$kw,
'http://be2canada.struenet.com/RegLP/?t202id=8115&t202kw='.$kw,
);
$searchlink = $landingpages[array_rand($landingpages)];
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: $searchlink”);
exit();
?>
EN

回答 2

Stack Overflow用户

发布于 2013-07-05 15:28:11

一定是php代码中某个地方的语法错误。

在php脚本的顶部添加以下内容:

代码语言:javascript
复制
error_reporting(E_ALL);
ini_set('display_errors', 1);

然后请提供任何错误消息(如果有)

编辑:对,你的链接中有一个语法错误:

代码语言:javascript
复制
‘http://be2canada.struenet.com/RuleLP/?t202id=3109&t202kw=’.$kw,
‘http://be2canada.struenet.com/RegLP/?t202id=8115&t202kw='.$kw,

将此撇号“更改为:”

代码语言:javascript
复制
'http://be2canada.struenet.com/RuleLP/?t202id=3109&t202kw='.$kw,
'http://be2canada.struenet.com/RegLP/?t202id=8115&t202kw='.$kw,

同时将此双引号更改为“this:”

代码语言:javascript
复制
header("HTTP/1.1 301 Moved Permanently");
header("Location: $searchlink");

甚至stackoverflow的代码加亮器也检测到了它

票数 1
EN

Stack Overflow用户

发布于 2013-07-05 15:48:08

相应地将‘’和“”更改为''或""。

看起来像是某个地方的代码复制粘贴。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17483292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档