如何在PHP5.3服务器上使用Braintree支付网关库3.5

如何在PHP5.3服务器上使用Braintree支付网关库3.5,php,codeigniter,error-handling,payment-gateway,braintree,Php,Codeigniter,Error Handling,Payment Gateway,Braintree,上面是braintree支付网关的沙盒支付模式,我想在godaddy服务器上使用它。它超越了错误,因此,任何人都可以帮助我实现此限制此错误的原因不是因为Braintree API,而是因为您正在运行的PHP版本 在PHP5.3中,数组declaration语法为: How to use Braintree payment gateway library 3.5 on php 5.3 Server it gives error : Parse error: syntax error, unexpe

上面是braintree支付网关的沙盒支付模式,我想在godaddy服务器上使用它。它超越了错误,因此,任何人都可以帮助我实现此限制

此错误的原因不是因为Braintree API,而是因为您正在运行的PHP版本

PHP5.3中,数组declaration语法为:

How to use Braintree payment gateway library 3.5 on php 5.3 Server it gives error : Parse error: syntax error, unexpected '[' on Braintree/OAuthGateway.php on line 64


require_once('braintree-php/lib/Braintree.php'); 
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('h9xhpt9b5zjgbkpj');
Braintree_Configuration::publicKey('4yfx77c9cns49y9d');
Braintree_Configuration::privateKey('54bbbab22711240ddb3d40e19ff6a13d');
但是PHP5.4支持以下数组语法:

$names = array('Steve Jobs', 'Steve Wozniak','Ronald Wayne');
Braintree 3.5可能是为PHP5.4或更高版本编写的,因此他们对数组声明使用了第二种语法,这是旧版本的php无法识别的,并被解释为语法错误

要解决这个问题,您可能需要升级PHP版本或降级Braintree库以支持当前的PHP版本


编辑

您可以通过以下链接查看他们的文档:

它清楚地提到:

需要PHP 5.4.0或更高版本以及PHP cURL扩展


愤怒的编码员是正确的。从3.0.0版开始,该库需要PHP5.4或更高版本。你可以
$names = ['Steve Jobs', 'Steve Wozniak','Ronald Wayne'];