【问题标题】:Stripe billing class not found - Laravel未找到条纹计费类 - Laravel
【发布时间】:2015-08-06 08:46:03
【问题描述】:

我已将 Stripe 库添加到我的 composer.json 文件中,运行所有命令只是为了检查...更新、转储自动加载等。

在我的类映射文件中显示了库:

'Stripe\\Account' => $vendorDir . '/stripe/stripe-php/lib/Account.php',

等等……

在我的应用程序文件夹中,我有我的类文件夹等:

app
  motivate
    Billing
      BillingInterface.php
      StripeBilling.php

在我的 StripeBilling 文件中,我这样引用 Stripe:

<?php

namespace Motivate\Billing;

class StripeBilling implements BillingInterface
{
  public function __construct()
  {
    Stripe::setApiKey(Config::get('stripe.secret_key'));
  }

这会引发错误:

Class 'Motivate\Billing\Stripe' not found

所以我的下一个想法是:

use \Stripe as Stripe;

返回类 Stripe not found。

这是哪里出了问题?谢谢:)

【问题讨论】:

    标签: php laravel-4 stripe-payments


    【解决方案1】:

    根据documentation

    要使用您的 API 密钥,您只需调用 \Stripe\Stripe::setApiKey() 用你的钥匙。 PHP 库会自动发送这个密钥 每个请求。

    所以,请尝试改用use \Stripe\Stripe as Stripe;

    【讨论】:

    • 正确!快到了,但你为我解决了。谢谢。
    猜你喜欢
    • 2015-10-22
    • 2021-08-03
    • 2015-08-11
    • 1970-01-01
    • 2021-02-21
    • 2018-05-03
    • 2013-04-16
    • 2017-09-25
    • 1970-01-01
    相关资源
    最近更新 更多