如何包含或引导paypal-core-sdk php [英] How to include or bootstrap the paypal-core-sdk php

查看:167
本文介绍了如何包含或引导paypal-core-sdk php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经手动从GitHub下载了forpal的paypal-core-sdk,我的服务器没有'composer',我只是手动将文件复制到文档根目录外的include目录中。问题是,当我打电话给服务器borks的某些类,并且不知道我在说什么...即

I've downloaded the paypal-core-sdk for php from GitHub manually, my server does not have 'composer' and I've just manually copied the files to an include directory outside the document root. Problem is when I go call on some of the classes the server borks and doesn't know what I'm talking about ... i.e.

Fatal error: Class 'PPApiContext' not found in /home/rctoronto/public_html/start.php on line 143

如果我在提供PPApiContext的文件中包含一次,它会移动到另一个错误,所以当我包含它抱怨的所有内容时,最终会继续。但是后来sdk有内部依赖问题。

if I include once on the file providing PPApiContext, it moves along to another error and so on eventually proceeds when I've included all the ones it complains about. But then the sdk has internal dependency issues.

我如何正式声明sdk库以便我的应用程序可以使用它 - 我已经在网上搜索并且没有管理找到这个问题的好答案。我已经尝试使用我的php.ini手动更改我的include_path,但仍然无法使用sdk的类。我没有访问/ usr / lib / php或/ usr / local / lib / php,因为我在共享服务器上。

How do I formally declare the sdk library so my app can use it - I've scoured the web and haven't managed to find a good answer to this question. I've tried manually altering my include_path using my php.ini and still it can't use the classes of the sdk. I don't have access to /usr/lib/php or /usr/local/lib/php as I am on a shared server.

这是'getAuthorize 'url for paypal(我已经手动使用include_once文件...

this is the 'getAuthorize' url for paypal (which I've gotten to work with manually include_once on the files...

$apicontext = new PPApiContext(array('mode' => 'live'));
$clientId = PP_CLIENTID;
$clientSecret = PP_SECRET;
$scope = array('openid', 'email'); 
$redirectUri = 'https://maskedurl.ca/login?ltype=pp&loginSubmit=true';
$pp_authUrl = PPOpenIdSession::getAuthorizationUrl($redirectUri, $scope , $clientId,       $apicontext); 

但我们如何正确地声明整个sdk库?

But how do we properly declare the sdk library in whole?

推荐答案

来自: http:// paypal .github.io / sdk /


如果您不想使用composer,可以获取SDK zip,解压缩文件到您的应用程序折叠呃并要求'vendor / autoload.php'文件。此文件注册可自动加载PayPal SDK文件的自定义自动加载器。

If you do not want to use composer, you can grab the SDK zip, unzip the file to your application folder and require the 'vendor/autoload.php' file. This file registers a custom autoloader that can autload the PayPal SDK files.

下载SDK zip

这篇关于如何包含或引导paypal-core-sdk php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆