我在尝试通过 bigcommerce api 连接到我的 bigcommerce 帐户时遇到问题。我根据此 url 遵循了以下准则:
我从这里下载了 bigcommerce.php 文件 https://raw.github.com/bigcommerce/bigcommerce-api-php/master/bigcommerce.php
然后将此文件包含到我的 index.php 文件中
然后我尝试在我的 index.php 文件中执行以下代码
require 'bigcommerce.php'; use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array('store_url' => 'storeurl', 'username' => 'admin', 'api_key' => '4581223546f2bf73840d84b4802cab039f249404' ));
Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);
$products = Bigcommerce::getProducts();
foreach($products as $product) { echo $product->name; 回声$产品->价格;}
但这对我不起作用。它显示以下警告
警告:第 16 行 C:\wamp\www\bigcommerce\index.php 中为 foreach() 提供的参数无效
然后我按照以下步骤操作:
我从这里下载了 api 的 ZIP 文件https://github.com/bigcommerce/bigcommerce-api-php/archive/master.zip
将该文件提取到我的项目文件夹中说 myfolder 即提取文件的目录是 myfolder/bigcommerce-api-php-master/
然后我包括了 myfolder/bigcommerce-api-php-master/bigcommerce.php
并尝试执行以下代码....
<?php
require 'bigcommerce-api-php-master/bigcommerce.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array(
'store_url' => 'https://store-atka90u.mybigcommerce.com/api/v2/',
'username' => 'admin',
'api_key' => '4581223546f2bf73840d84b4802cab039f249404'
));
Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);
$products = Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
}
?>
但即使在我已经在我的帐户中添加了 2 种产品后,它也会再次显示相同的警告。
警告:第 16 行 C:\wamp\www\bigcommerce\index.php 中为 foreach() 提供的参数无效
任何形式的帮助都将被应用...... plzzzz帮助......非常需要......