大商务 API 身份验证和调试


Bigcommerce API authentication and debugging

这是我的代码:

<html>
    <head>
        <title>Bigcommerce API</title>
    </head>
    <body>
        <?php
        include('bigcommerce.php');
        use Bigcommerce'Api'Client as Bigcommerce;
        Bigcommerce::configure(array(
        'store_url' => 'https://xxx.mybigcommerce.com/api/v2/',
        'username'  => 'admin',
        'api_key'   => 'xxx'
        ));
        $ping = Bigcommerce::getTime();
        if ($ping) echo $ping->format('H:i:s');
        echo('hello');
        ?>
    </body>
</html>

我运行这个,什么也没发生。我查看浏览器,它没有显示任何错误。我什至如何开始调试?

编辑

取出了/api/v2,现在我看到此错误:

致命错误:未捕获的异常"异常",消息为"日期时间::__construct((:依赖系统的时区设置是不安全的。您需要使用 date.timezone 设置或 date_default_timezone_set(( 函数。如果您使用了其中任何一种方法,但仍然收到此警告,则很可能拼写错了时区标识符。我们现在选择了时区'UTC',但请设置日期.时区来选择你的时区。 在/Library/WebServer/Documents/bigcommerce.php:404 堆栈跟踪:#0/Library/WebServer/Documents/bigcommerce.php(404(: DateTime->__construct('@1418752201'( #1/Library/WebServer/Documents/index.php(19(: Bigcommerce''Api''Client::getTime(( #2 {main} 扔在第 404 行的/Library/WebServer/Documents/bigcommerce.php

谢谢。

编辑

我将以下内容添加到索引中.php它有效!

if( ! ini_get('date.timezone') )
{
    date_default_timezone_set('GMT');
}

我将以下内容添加到索引中.php它有效!

if( ! ini_get('date.timezone') )
{
    date_default_timezone_set('GMT');
}

– 灯笼胭脂