为项目启动计时器
请求参数
参数 | 类型 | 说明 | 必需的 |
---|---|---|---|
action | string | “StartTaskTimer” | Required |
timerid | int | 待结束任务的id | Required |
projectid | int | 任务计时器的项目 ID | Required |
adminid | int | 与计时器关联的管理员 ID | Optional |
start_time | int | 作为 unix 时间戳的开始时间。如果未提供,则默认为 time() | Optional |
end_time | int | 作为 unix 时间戳的开始时间。 | Optional |
响应参数
参数 | 类型 | 说明 |
---|---|---|
result | string | 操作结果:成功或错误 |
message | string | '开始计时器已设置' |
示例请求 (CURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'StartTaskTimer',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'projectid' => '1',
'timerid' => '1',
'adminid' => '2',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例请求(本地 API)
$command = 'StartTaskTimer';
$postData = array(
'projectid' => '1',
'timerid' => '1',
'adminid' => '2',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例响应 JSON
{
"result": "success",
"message": "Start Timer Has Been Set"
}
错误响应
可能的错误条件响应包括:
- 项目 ID 为必填项
- 未找到项目 ID
- 未设置定时器 ID
- 未找到计时器 ID
- 未找到管理员 ID
相关用法
- PHP String wordwrap()用法及代码示例
- PHP String sprintf()用法及代码示例
- PHP String ucwords()用法及代码示例
- PHP String substr()用法及代码示例
- PHP String localeconv()用法及代码示例
- PHP String strstr()用法及代码示例
- PHP String htmlspecialchars_decode()用法及代码示例
- PHP String sscanf()用法及代码示例
- PHP String strtr()用法及代码示例
- PHP String ucfirst()用法及代码示例
- PHP String quoted_printable_encode()用法及代码示例
- PHP String substr_compare()用法及代码示例
- PHP String nl2br()用法及代码示例
- PHP String vsprintf()用法及代码示例
- PHP String strtolower()用法及代码示例
- PHP String strspn()用法及代码示例
- PHP String substr_count()用法及代码示例
- PHP String strtoupper()用法及代码示例
- PHP String quoted_printable_decode()用法及代码示例
- PHP String转Float用法及代码示例
- PHP String nl_langinfo()用法及代码示例
- PHP String strtok()用法及代码示例
- PHP String vprintf()用法及代码示例
- PHP String substr_replace()用法及代码示例
- PHP String str_replace()用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 StartTaskTimer。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。