这是我的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;
}
}
}
答案 0 :(得分:0)
如果您使用的是Stripe-PHP库<2.0版本,则可能需要调用from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDriverWait
url = 'http://www.attheraces.com/racecard/Wolverhampton/6-October-2018/1715'
driver = webdriver.Chrome()
driver.get(url)
driver.implicitly_wait(2)
driver.find_element_by_xpath('//*[@id="racecard-tabs-1061960"]/div[1]/div/div[1]/ul/li[2]/a').click()
WebDriverWait(driver, 5).until(expected_conditions.presence_of_element_located((By.XPATH, '//*[@id="tab-racecard-sectional-times"]/div/div[1]/div[1]/div[2]/div/button')))
# method 1
for horse in driver.find_elements_by_class_name('card-item'):
horseName = horse.find_element_by_class_name('form-link').text
times = horse.find_elements_by_class_name('sectionals-time')
times = [time.text for time in times]
print('{}: {}'.format(horseName, times))
print()
# method 2
for horse in driver.find_elements_by_class_name('card-item'):
for time in horse.find_elements_by_class_name('sectionals-time'):
print(time.text)
print()
driver.close()
而不是Stripe_Plan::all()
也就是说,升级到Stripe PHP库的较新版本以利用最新功能https://github.com/stripe/stripe-php
可能会有所帮助