drelgkxl93433 2015-07-22 22:01
浏览 419

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

I am attempting to redirect users to a success page when their payment is complete. This is how the code looks:

<?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
}
?>

The code does redirect and the address in the browser's address bar is the one that I want and is on the server however I get a 404 error each time.

  • 写回答

1条回答 默认 最新

  • doujumiao5024 2015-07-22 23:10
    关注

    Check if you have any URL rewrite rule.

    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计一个单管共射放大电路
  • ¥20 fluent无法启动
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架