发现404错误页面未找到。路由无法匹配请求的URL。没有例外

时间:2015-12-15 11:38:45

标签: php routing zend-framework2 stripe-payments checkout

我已使用条带文档在我的网站上实现了条带系统

What is a correct mime type for docx, pptx etc?

我已经制作了付款文件和收费文件。

这是付款文件的代码

    <div class="panel-body">
        <form action="in/payment/charge.phtml" method="POST">
          <script
            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
            data-key="xxxxxxxxxxxxxxxxxxx"
            data-image="logo.png"
            data-name="abc.com"
            data-description="EBS($750.00)"
            data-amount="75000">
          </script>
        </form> 
    </div>

此外,收费文件的代码包括try catch子句。

     <?php

try {
  require_once('Stripe/lib/Stripe.php');
  Stripe::setApiKey("secret_key_here"); //Secret Key

  $charge = Stripe_Charge::create(array(
  "amount" => 750,
  "currency" => "usd",
  "card" => $_POST['stripeToken'],
  "description" => "Charge for Events Plan Subscription."
 ));
    //send the file, this line will be reached if no error was thrown above
    echo "<h1>Your payment has been completed. You have Subscribed to Events Basic Plan</h1>";


//you can send the file to this email:
echo $_POST['abc@gmail.in'];
}
//catch the errors in any way you like

 catch(Stripe_CardError $e) {

 }


 catch (Stripe_InvalidRequestError $e) {
 // Invalid parameters were supplied to Stripe's API

 } catch (Stripe_AuthenticationError $e) {
 // Authentication with Stripe's API failed
 // (maybe you changed API keys recently)

} catch (Stripe_ApiConnectionError $e) {
  // Network communication with Stripe failed
} catch (Stripe_Error $e) {

// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {

// Something else happened, completely unrelated to Stripe
}
?>

我点击付卡后立即显示条纹弹出窗口。但输入详细信息后不久,按下付款按钮显示404页面,上面有消息:

A 404 error occurred 
Page not found.  
The requested URL could not be matched by routing. 
No Exception available

我是zend框架的新手。我在module.config.php中进行了必要的路由更改。

        return array(
'router' => array(
'routes' => array(
       'rpayment' => array(
                'type'    => 'Segment',
                'options' => array(
                        'route'    => 'payment[/:action[/]]',
                        'constraints' => array(
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                        ),
                        'defaults' => array(
                                '__NAMESPACE__' => 'Webin\Controller',
                               'controller' => 'Payment',
                                'action' => 'index',
                        ),
                ),
        ),

我不知道我哪里错了?任何人都可以指出错误吗?

1 个答案:

答案 0 :(得分:0)

这是正确的路径吗?

require_once('Stripe/lib/Stripe.php');

条纹是否位于网站根目录下的文件夹中?我最近花了太多时间在这样一个小小的忽视上。我不得不将../添加到Stripe / lib / Stripe.php

的前面