Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器3上的条纹_Php_Codeigniter_Stripe Payments - Fatal编程技术网

Php 代码点火器3上的条纹

Php 代码点火器3上的条纹,php,codeigniter,stripe-payments,Php,Codeigniter,Stripe Payments,我在一个codeigniter项目中加入了stripe,我一直在跟踪和。 我正在开发lamp Apache 2.4和Ubuntu 14 L.T.S 但是,我一直找不到404。似乎该路由没有被服务器拾取。 我仔细检查了我的控制器和视图,但没有发现任何错误 付款类别内的付款方式为: public function pay(){ require_once('vendor/autoload.php'); $token = $_POST['stripeToken']; \Stripe\

我在一个codeigniter项目中加入了stripe,我一直在跟踪和。 我正在开发lamp Apache 2.4和Ubuntu 14 L.T.S

但是,我一直找不到404。似乎该路由没有被服务器拾取。 我仔细检查了我的控制器和视图,但没有发现任何错误

付款类别内的付款方式为:

public function pay(){

  require_once('vendor/autoload.php');

  $token  = $_POST['stripeToken'];

  \Stripe\Stripe::setApiKey("sk_test_somekey");

  $customer = \Stripe\Customer::create(array(
      'email' => 'customer@example.com',
      'source'  => $token

  ));

  $charge = \Stripe\Charge::create(array(

      'customer' => $customer->id,
      'amount'   => 5000,
      'currency' => 'usd'

  ));
  echo '<h1>Successfully charged $50.00!</h1>';
}
阿帕奇说:

The requested URL /Payment/pay was not found on this server.
欢迎任何指点

编辑:routes.php如下所示:

$route['default_controller'] = 'payment';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

我找到了一个解决方案,并想与大家分享

确保您的代码具有:

$autoload['helper'] = array('url');
如果你有
.htaaccess
确保它可以在没有
index.php
的情况下加载每个请求。在我的情况下,我有一些类似:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/  [L]
不管出于什么原因,这都没有帮助,所以我最终删除了它,并在路由上留下了
index.php
,我知道,这很难看

最后,我按照建议将
index.php
添加到表单的操作路径中,结果成功了

希望它能帮助别人


感谢@Drlot指出这一点。

我找到了一个解决方案,并想与大家分享

确保您的代码具有:

$autoload['helper'] = array('url');
如果你有
.htaaccess
确保它可以在没有
index.php
的情况下加载每个请求。在我的情况下,我有一些类似:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/  [L]
不管出于什么原因,这都没有帮助,所以我最终删除了它,并在路由上留下了
index.php
,我知道,这很难看

最后,我按照建议将
index.php
添加到表单的操作路径中,结果成功了

希望它能帮助别人


感谢@Drbot指出这一点。

如果您尝试
@Drbot,我已经尝试过的第一个,第二个会返回错误。第二个可能会返回错误,因为您没有加载url帮助器。无论您使用何种方法加载表单视图,请使用
$this->load->helper('url')
。哦,是的,您是对的,我忘记了helper,但ApacheIs控制器文件名
Payment.php
未找到路由,首字母大写,类名相同?如果您尝试
@drot,我已经尝试过的第一个,第二个返回错误第二个可能返回错误,因为您没有加载url帮助程序。无论您使用何种方法加载表单视图,请使用
$this->load->helper('url')
。哦,是的,我忘记了helper,但ApacheIs控制器文件名
Payment.php
未找到路由,首字母大写,类名相同?