2013-08-26 33 views
1

我有一个处理付款提供商付款的脚本,然后使用PHP重定向显示“谢谢”页面。标题位置重定向使PHP命令执行两次

来源:(Websend.php包括源是在这里:http://pastebin.com/raw.php?i=TmmysJiD)success.html的

include_once 'Websend.php'; 
if ($file != "GREAT") { 
    header("Location: ../failed.html"); 
    exit(); 
} else { 
    $ws = new Websend("192.168.56.105"); 
    $ws->connect("passwd"); 
    $ws->doCommandAsConsole("give " . $token . " 2000"); 
    $ws->disconnect(); 
    header('Location: ../success.html'); 
    exit(); 
} 

<head> 
    <meta http-equiv="refresh" content="0; url=http://site.com/index.html"> 
</head> 
<script type="text/javascript"> 
    alert("Some alert"); 
</script> 

然而header("Location: ../success.html");导致该命令运行两次(并为用户金额为两次,不应该发生。 当我删除header("Location: ../success.html");时,代码的工作原理应该是这样:

为什么会发生这种情况?

+0

是代码'succes.html'?如果是的话,答案应该是不言而喻的 – 2013-08-26 20:32:36

+0

请发布'succes.html' –

+0

@Dagon的内容否,这是付款提供商重定向到的PHP文件。 – Timothy

回答

1

这是令人耳目一新success.html

<meta http-equiv="refresh" content="0; url=http://site.com/index.html"> 

EDITED

你试图删除<meta http-equiv="refresh" content="0; url=http://site.com/index.html">?也请尝试更改header('Location: ../success.html');header('Location: ../index.html');

+0

是,那里为什么 – 2013-08-26 20:40:55

+0

这就像下面这样:“用户付款 - >支付提供商重定向到checkpayment.php - >支票支付检查它是否真正付费,然后 - >重定向到成功或失败html - >这个文件显示一个HTML警报,然后重定向到主页。 – Timothy

+0

是你的顶部'php'代码所在的主页? – Vector