私はcodeigniterプロジェクトにストライプがあり、私はLink 1とLink 2に従っています。 私はランプApache 2.4とUbuntu 14 L.T.Sに作業中ですcodeigniter 3のストライプ
しかし、私は取得していません404が見つかりました。ルートがサーバーによってピックアップされていません。 コントローラとビューを慎重に見直しましたが、間違ったものは見つかりませんでした。
支払いクラス内の給与方法は次のとおりです。
public function pay(){
require_once('vendor/autoload.php');
$token = $_POST['stripeToken'];
\Stripe\Stripe::setApiKey("sk_test_somekey");
$customer = \Stripe\Customer::create(array(
'email' => '[email protected]',
'source' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged $50.00!</h1>';
}
そして、私のビュー内の自分のフォームのようになります:
:設定ファイルは以下のように変更されたので、私は作曲を使用してい<?php require_once('vendor/autoload.php'); ?>
<form action="Payment/pay" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_some_key"
data-description="Access for a year"
data-amount="5000"
data-locale="auto">
</script>
</form>
$config['composer_autoload'] = APPPATH.'vendor/autoload.php';
Apache spits out:
The requested URL /Payment/pay was not found on this server.
どのポインタも大歓迎です。
編集:私は解決策を発見し、それを共有したいと思った
$route['default_controller'] = 'payment';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
あなたが '
@TheDrot、私がすでに試した最初のもの、2番目のものはエラーを返す – Tmute
urlヘルパーをロードしていないので、おそらく2番目のエラーが発生します。どのようなメソッドでも、フォームビューを読み込むには '$ this-> load-> helper( 'url')'を使います。 – TheDrot