Laravel 调用未定义的方法 Stripe\Plan::all()
Laravel Call to Undefined Method Stripe\Plan::all()
这是我的 Laravel 代码,但我想我可能使用了旧版本的 Stripe 函数。这就是我收到此错误的原因,有人可以帮我解决这个问题吗?
<?php
use Illuminate\Support\Facades\Cache;
use Stripe\Stripe;
class Plan
{
public static function getStripePlans()
{
// Set the API Key
Stripe::setApiKey(User::getStripeKey());
try {
// Fetch all the Plans and cache it
return Cache::remember('stripe.plans', 60 * 24, function () {
return \Stripe\Plan::all()->data;
});
} catch (\Exception $e) {
return false;
}
}
}
如果您使用的 Stripe-PHP 库版本 < 2.0,您可能需要调用 Stripe_Plan::all()
而不是 \Stripe\Plan::all()
也就是说,升级到更新版本的 Stripe PHP 库可能有助于利用更多最新功能 https://github.com/stripe/stripe-php
这是我的 Laravel 代码,但我想我可能使用了旧版本的 Stripe 函数。这就是我收到此错误的原因,有人可以帮我解决这个问题吗?
<?php
use Illuminate\Support\Facades\Cache;
use Stripe\Stripe;
class Plan
{
public static function getStripePlans()
{
// Set the API Key
Stripe::setApiKey(User::getStripeKey());
try {
// Fetch all the Plans and cache it
return Cache::remember('stripe.plans', 60 * 24, function () {
return \Stripe\Plan::all()->data;
});
} catch (\Exception $e) {
return false;
}
}
}
如果您使用的 Stripe-PHP 库版本 < 2.0,您可能需要调用 Stripe_Plan::all()
而不是 \Stripe\Plan::all()
也就是说,升级到更新版本的 Stripe PHP 库可能有助于利用更多最新功能 https://github.com/stripe/stripe-php