我和Omnipay搞乱了,我收到了这条消息:
致命错误:未捕获错误:Class' Omnipay \ Omnipay'找不到
目录列表:
test.php的
<?php
use Omnipay\Omnipay;
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('abc123');
$formData = array('number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2016', 'cvv' => '123');
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'USD', 'card' => $formData))->send();
if ($response->isRedirect())
{
// redirect to offsite payment gateway
$response->redirect();
}
elseif ($response->isSuccessful())
{
// payment was successful: update database
print_r($response);
}
else
{
// payment failed: display message to customer
echo $response->getMessage();
}
?>
我不会以这种方式编写PHP代码,此时网站的指示也很模糊。它看起来是节省时间的绝佳方式,但是......我不会这样编码。我错过了什么?
答案 0 :(得分:0)
如果你正在使用Composer,你需要确保包含Composer auto-loader - 没有它,你的require __DIR__ . '/vendor/autoload.php';
脚本不知道Composer正在做什么。
根据他们的文档,将其放在文件的顶部:
composer install
假设您已运行composer update
或test.php
来下载依赖项,那么您的use
脚本将运行Composer自动加载器,并使其可用于from __future__ import print_function
import datetime
now = datetime.datetime.now()
from titlecase import titlecase
f=open(r'C:\Users\GX\everyFirstLetterCapitalized.txt')
f.seek(0)
message = f.read()
outPut=titlecase(message)
f=open(r'C:\Users\GX\everyFirstLetterCapitalizedOutput.txt', 'w')
f.write("new output:-- {a}\n".format(a=now)+outPut)
f.close()
言。