僅通過本地 API 設置係統配置值。
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “SetConfigurationValue” | Required |
setting | string | 要更改的設置名稱 | Required |
value | string | 要設置的值。將值留空以取消設置。 | Required |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | string | 操作結果:成功或錯誤 |
value_changed | bool | 確認值已更改 |
示例請求 (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' => 'SetConfigurationValue',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'setting' => 'PremiumDomains',
'value' => '',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'SetConfigurationValue';
$postData = array(
'setting' => 'PremiumDomains',
'value' => '',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success",
"value_changed": "true"
}
錯誤響應
可能的錯誤條件響應包括:
- 需要設置參數
- 參數設置名稱無效
- 參數值是必需的
相關用法
- PHP WHMCS SendAdminEmail用法及代碼示例
- PHP WHMCS ServerDelete用法及代碼示例
- PHP WHMCS ServiceDelete用法及代碼示例
- PHP WHMCS SendEmail用法及代碼示例
- PHP WHMCS ServerEdit用法及代碼示例
- PHP WHMCS ServiceRecurringCompleted用法及代碼示例
- PHP WHMCS SendQuote用法及代碼示例
- PHP WHMCS ServiceEdit用法及代碼示例
- PHP WHMCS ServerAdd用法及代碼示例
- PHP String wordwrap()用法及代碼示例
- PHP SimpleXMLElement children()用法及代碼示例
- PHP SplPriorityQueue isCorrupted()用法及代碼示例
- PHP SplObjectStorage key()用法及代碼示例
- PHP SplHeap extract()用法及代碼示例
- PHP String sprintf()用法及代碼示例
- PHP SplPriorityQueue insert()用法及代碼示例
- PHP SplFixedArray key()用法及代碼示例
- PHP String ucwords()用法及代碼示例
- PHP SplFileInfo getRealPath()用法及代碼示例
- PHP SplObjectStorage rewind()用法及代碼示例
- PHP SplFileInfo getPerms()用法及代碼示例
- PHP SplHeap top()用法及代碼示例
- PHP SplFileInfo getExtension()用法及代碼示例
- PHP String substr()用法及代碼示例
- PHP WHMCS SubmitTicketAnswerSuggestions用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 SetConfigurationValue。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。