Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions TimRestApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,25 @@ class TimRestAPI extends TimRestInterface
protected $contenttype = 'json';
protected $apn = '0';

/**
* 是否开启调试模式
* @var bool
*/
protected $debug = true;


/**
* 初始化函数
* @param int $sdkappid 应用的appid
* @param string $identifier 访问接口的用户
* @param bool $debug 是否开启调试模式(默认不开启)
*/
function init($sdkappid, $identifier)
function init($sdkappid, $identifier, $debug = false)
{

$this->sdkappid = $sdkappid;
$this->identifier = $identifier;
$this->debug = $debug;
}

/**
Expand All @@ -48,8 +56,11 @@ public function api($service_name, $cmd_name, $identifier, $usersig, $req_data,
. "&sdkappid=" . $this->sdkappid
. "&contenttype=" . $this->contenttype;
$url = $this->http_type . $this->im_yun_url . '/' . $this->version . '/' . $service_name . '/' .$cmd_name . '?' . $parameter;

if($print_flag)

/**
* 如果开启了调试模式,打印请求和响应的相应信息
*/
if($this->debug)
{
echo "Request Url:\n";
echo $url;
Expand Down