2016-10-19 48 views
0

我一直有麻烦整合条纹到我的网站,因为它似乎每次我解决问题时出现一个不同的问题。PHP条纹集成

我决定使用本地条纹文件夹库而不是安装它。

我的团购页面看起来是这样的:

<body> 

    <?php require_once('./config.php'); ?> 

    <form action="charge.php" method="post"> 
    <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" 
     data-key="<?php echo $stripe['publishable_key']; ?>" 
     data-description="Access for a year" 
     data-amount="5000" 
     data-locale="auto"></script> 
</form>   
</body> 

我charge.php看起来是这样的:

<?php 
    require_once('./config.php'); 
    $token = $_POST['stripeToken']; 
    $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>'; 
?> 

最后,我的config.php文件:(星取代了我的钥匙)

<?php 
require_once('./Stripe/init.php'); 
$stripe = array(
    "secret_key"  => "sk_test_***********************", 
    "publishable_key" => "pk_test_***********************" 
); 
\Stripe\Stripe::setApiKey($stripe['secret_key']); 

我的条纹库文件夹与我的其他页面处于同一水平,这可能是我的问题,为了展示这一点,我将制作一个渐变d符号列表:

  • 的config.php
  • 的index.php
  • charge.php
  • 条纹(文件夹)
    • 内容在文件夹

什么我做错了吗?我已经上传的文件夹到我的虚拟主机提供商的服务器,当我去到那里应该是一个按钮的页面,我收到一个错误:

Warning: require(/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php): failed to open stream: No such file or directory in /home1/desmoriz/public_html/Stripe/init.php on line 32

Fatal error: require(): Failed opening required '/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php' (include_path='.:/opt/php56/lib/php') in /home1/desmoriz/public_html/Stripe/init.php on line 32

回答

0

我想你已经检查过该文件AttachedObject.php是有效的文件夹。

此外,请检查所有条纹文件夹及其子文件夹/文件的CHMOD是否设置为755,以便PHP可以访问其中的文件。