使用PHP重定向到现有页面时出现404错误

时间:2015-07-22 22:01:11

标签: php

我正在尝试在付款完成后将用户重定向到成功页面。这就是代码的外观:

<?php

session_start();

$total = $_SESSION['total'];

require_once('stripe-php-2.3.0/init.php');
// Set your secret key: remember to change this to your live secret key    in production
// See your keys here https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("");

// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];

// Create the charge on Stripe's servers - this will charge the user's   card
try {
    $charge = \Stripe\Charge::create(array(
                "amount" => $total, // amount in cents, again
                "currency" => "gbp",
                "source" => $token,
                "description" => "")
    );
    header('Location: index2.php');
} catch (\Stripe\Error\Card $e) {
// The card has been declined
}
?>

代码重定向,浏览器地址栏中的地址是我想要的,并且在服务器上,但每次都会出现404错误。

1 个答案:

答案 0 :(得分:0)

检查您是否有任何网址重写规则。

相关问题