Home >php教程 >php手册 >分享淘宝API辅助函数-适用CI框架

分享淘宝API辅助函数-适用CI框架

WBOY
WBOYOriginal
2016-05-25 16:40:001230browse

最近在重写一个淘宝客的网站,考虑到以后的拓展性,所以把它整合进CI里面了,这就出现个问题了,淘宝的SDK怎么整合进类库呢?仔细阅读淘宝API文档后,发现一个非SDK调用方法,我在这基础上加以修改整合成CI的helper函数,现在把源码分享给大家,希望帮到有需要的同学.

调用方法很简单,传入一个数组参数,其中method是你打算调用的API接口,其余的参数根据API接口的实际需要填入,我这里给个调用例子给大家看下,代码如下:

$paramArr = array(     
'method'    => 'taobao.taobaoke.items.get',  //API名称     
'fields'    =>'num_iid,title,nick,pic_url,price,click_url,seller_credit_score,     
commission,commission_rate,volume',     
'pid'       =>YOUR PID,     
'page_size' =>YOUR PAGE_SIZE,     
'sort'      =>YOUR SORT,     
'keyword'   =>your keyword,     
);
$this->load->helper('taoapi');     
$result['item_list'] = send($paramArr);


文章链接:

随便收藏,请保留本文地址!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn