0

这有点超出我的想象,但基本上我需要在某人使用贝宝从我的网站购买后重定向回我网站上的特定页面。

我正在使用一个插件,并被告知在第 27-31 行(“成功”评论下的行)编辑 paypal.ipn.php 文件。如果有人愿意帮助我,将不胜感激!

include "includes/header.php";
?>
<div id="index">
<h1><?php echo PP_THANK_H1?></h1>
<?php
switch ($_GET['action']) { 
    case 'success':      // Order was successful...
echo "<p>".PP_THANKYOU."</p>";
break;

case 'cancel':       // Order was canceled...
echo "<p>".PP_CANCEL."</p>";
break;
4

1 回答 1

0

您可以header()在 PHP 中使用,但应事先删除所有输出(如 HTML 标记)。

例子:

<?
include "includes/header.php"; //make sure this file doesn't output anything, else the redirect will give an error

switch ($_GET['action']) { 
    case 'success':      // Order was successful...
    header("Location: www.yoursite.com/redirectothispage.php"); //redirect to this page
    break;

    case 'cancel':       // Order was canceled...
    header("Location: www.yoursite.com/redirectothispageifcancelled.php"); //redirect to this page
    break;

如果您确实在 header.php 中有无法删除的输出,那么元重定向会更好。

而不是header();你会使用这个 HTML 代码:

echo '<meta http-equiv="refresh" content="0;URL=http://www.yoursite.com/redirecttothispage.com" />';
于 2013-04-19T00:17:50.537 回答