2013-04-19 25 views
0

這是一個有點超過我的頭,但基本上我需要重新定向一個人後,他們用我的網站貝寶購物回到特定頁面在我的網站上。什麼js代碼輸入重定向後用PayPal購買

我正在使用一個插件,並被告知要編輯第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; 
+0

你應該送返回URL到PayPal – 2013-04-19 00:15:08

+0

是該解決方案?我怎麼做?對不起,我不是一個程序員,就像我說過的,這有點過頭了。我對html和css很好。 – NFdesign

+0

要麼學習或僱用一個人,期望在互聯網上的陌生人爲你做這是一個壞主意。 – 2013-04-19 00:19:07

回答

0

您可以在PHP中使用header(),但之後所有輸出(如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" />'; 
+1

非常感謝edwardmp,第二個選項偉大的工程! – NFdesign