淘宝SDK-PhalApi框架的引入问题
2018-05-18 本文已影响97人
慢生活书单
第一步:从淘宝开放平台下载相应的SDK文件 并解压

第二步:将解压好的SDK文件夹复制到PhalApi项目的Vendor目录下

第三步:PhalApi的统一初始化文件中加载淘宝SDK的入口文件
// 引入淘宝客SDK的TopSdk.php
require_once API_ROOT . '/vendor/aliyuncs/taobao_sdk_php/TopSdk.php';


第四步:在领域层import相应的class即可使用
<?php
namespace App\Domain\Test;
use TbkItemGetRequest;
use TopClient;
class Test {
public function test($params){
$c = new TopClient;
$c->appkey = "";
$c->secretKey = "";
$req = new TbkItemGetRequest;
$req->setFields("");
$req->setQ("");
$resp = $c->execute($req);
return $resp;
}
}