AbleCloud PHP SDK  1.8.x
PHP SDK of AbleCloud API
Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
ACContext类 参考

Public 成员函数

 __construct ($developerId, $accessKey, $secretKey, $majorDomain, $runtimeMode, $routerAddress)
 
 getDeveloper ()
 
 getMajorDomain ()
 
 getRouterAddress ()
 
 isProductionMode ()
 
 setHandset ($name, $version='', $id='', $osName='')
 
 setClientAddress ($clientIP)
 
 addExtHttpHeader ($header, $value)
 
 getExtHttpHeaders ()
 
 getTraceId ()
 
 setTraceId ($traceId)
 

静态 Public 成员函数

static newTraceId ()
 

详细描述

访问AbleCloud服务时的环境信息。

构造及析构函数说明

◆ __construct()

ACContext::__construct (   $developerId,
  $accessKey,
  $secretKey,
  $majorDomain,
  $runtimeMode,
  $routerAddress 
)

构造函数。

参数
$developerIdint AbleCloud开发者帐号ID。
$accessKeystring 开发者的Access Key。
$secretKeystring 开发者的Secret Key。
$majorDomainstring 本地服务对应的主域的名字。
$runtimeModestring 运行模式:test(测试模式),production(生产模式)。
$routerAddressstring AbleCloud远程服务的入口地址。

成员函数说明

◆ addExtHttpHeader()

ACContext::addExtHttpHeader (   $header,
  $value 
)

为发给AbleCloud云端的HTTP请求配置自定义的HTTP Header。

参数
$headerstring 是要配置的HTTP Header的名字。
$valuestring 是$header对应的值。

◆ getDeveloper()

ACContext::getDeveloper ( )

取AbleCloud开发者信息。

返回
ACDeveloper 返回ACDeveloper对象。

◆ getExtHttpHeaders()

ACContext::getExtHttpHeaders ( )

取自定义的HTTP Header信息。

返回
array 返回一个关联数组。数组的每一个键值对表示一项自定义的Header。

◆ getMajorDomain()

ACContext::getMajorDomain ( )

取本地服务对应的主域的名字。

返回
string 返回本地服务对应的主域的名字。

◆ getRouterAddress()

ACContext::getRouterAddress ( )

取AbleCloud远程服务的访问入口地址。

返回
string 返回AbleCloud远程服务的访问入口地址。

◆ getTraceId()

ACContext::getTraceId ( )
弃用:
不再使用。使用ACRequest::getTraceId。

取当前的Trace-Id。

返回
string 当前的Trace-Id。

◆ isProductionMode()

ACContext::isProductionMode ( )

检查是否配置为生产环境。

返回
bool 返回TRUE表示当前配置为生产环境,否则表示为测试环境。

◆ newTraceId()

static ACContext::newTraceId ( )
static
弃用:
不再使用。使用ACRequest::newTraceId。

生成一个Trace-ID。

返回
string 是符合RFC 4122 - Section 4.4规范的UUID的十六进制表示形式。

◆ setClientAddress()

ACContext::setClientAddress (   $clientIP)

显示设置请求中携带的客户端的IP地址。

参数
$clientIPstring IP地址。本方法不检查该参数的值的格式,需要调用者保证参数的有效性。

◆ setHandset()

ACContext::setHandset (   $name,
  $version = '',
  $id = '',
  $osName = '' 
)

设置用户控制设备时所使用的终端工具的信息。

参数
$namestring 是终端工具所使用的应用的名字,如'weixin'(表示微信终端)等。
$versionstring 是终端工具所使用的应用的版本信息。缺省值为空字符串。
$idstring 是终端工具的ID,用于标识该工具。缺省值为空字符串。
$osNamestring 是终端工具所使用的操作系统的名字,如android,ios等。

◆ setTraceId()

ACContext::setTraceId (   $traceId)
弃用:
不再使用。使用ACRequest::setTraceId。

设置Trace-Id。

参数
$traceIdstring 是符合RFC 4122 - Section 4.4规范的UUID的十六进制表示形式,用来作为请求的Trace-Id。

该类的文档由以下文件生成: