PHP code example of thinksvip / dianjiang-sdk
1. Go to this page and download the library: Download thinksvip/dianjiang-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thinksvip / dianjiang-sdk example snippets
use DianJiang\API\Request;
use DianJiang\DianJiangAPI;
use DianJiang\API\ResponseStatus;
// 获取授权信息
$api = new DianJiangAPI('Access-Token','YOU_SHOP_NAME');
// 组装请求订单列表数据
$r = Request::getOrdersRequest("2021-04-09 08:40:17","2021-04-12 08:40:17",'paid');
// 发起请求 获取数据
$response = $api->sendRequest($r);
switch ($response->status) {
case ResponseStatus::OK:
foreach ($response->orders as $order) {
// 获取订单id
print_r($order->id);
// 获取商品全部信息
print_r($order->line_item);
// 获取商品标题
print_r($order->line_item->product_title);
}
break;
default:
print_r($response);
break;
}