PHP code example of ckoo / youzan-sdk
1. Go to this page and download the library: Download ckoo/youzan-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/ */
ckoo / youzan-sdk example snippets
/**
* 获取商品列表
*/
$service = $youzan->goods();
list($items, $total) = $service->itemsOnsaleGet();
/**
* 添加商品
*/
use Youzan\Service\Parameters\GoodsParamters;
// 创建商品参数对象
$parameters = new GoodsParamters();
$parameters->title = '测试商品标题';
$parameters->price = '999.00';
$parameters->images = array(
'http://aaa.jpg',
'http://bbb.jpg',
'/path/xxxx/images/ccc.jpg'
);
// 添加商品
$item = $service->itemAdd($parameters);