為用戶啟動密碼重置過程。
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “ResetPassword” | Required |
id | int | 要重置的用戶 ID。 id 隻能屬於一個用戶。 | Optional |
string | 用戶更新的電子郵件地址。需要 $id 或 $email | Optional |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | 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' => 'ResetPassword',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'email' => '[email protected]',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'ResetPassword';
$postData = array(
'email' => '[email protected]',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success"
}
錯誤響應
可能的錯誤條件響應包括:
- 請提供一個有效的電子郵件地址
- 未找到用戶
- 請輸入電子郵件地址或提供身份證件
相關用法
- PHP ReflectionClass getTraitAliases()用法及代碼示例
- PHP ReflectionMethod isPrivate()用法及代碼示例
- PHP ReflectionClass getTraits()用法及代碼示例
- PHP ReflectionExtension isPersistent()用法及代碼示例
- PHP ReflectionClass isUserDefined()用法及代碼示例
- PHP ReflectionClass getProperty()用法及代碼示例
- PHP ReflectionClass getProperties()用法及代碼示例
- PHP ReflectionParameter __toString()用法及代碼示例
- PHP ReflectionClass __toString()用法及代碼示例
- PHP ReflectionMethod isStatic()用法及代碼示例
- PHP ReflectionClass hasMethod()用法及代碼示例
- PHP ReflectionClass isIterateable()用法及代碼示例
- PHP ReflectionClass hasConstant()用法及代碼示例
- PHP ReflectionProperty isPublic()用法及代碼示例
- PHP ReflectionClass getTraitNames()用法及代碼示例
- PHP Reflection getName()用法及代碼示例
- PHP ReflectionClass export()用法及代碼示例
- PHP ReflectionExtension getDependencies()用法及代碼示例
- PHP ReflectionMethod invokeArgs()用法及代碼示例
- PHP WHMCS ReportViewPreOutput用法及代碼示例
- PHP ReflectionGenerator getTrace()用法及代碼示例
- PHP ReflectionExtension isTemporary()用法及代碼示例
- PHP ReflectionProperty getDeclaringClass()用法及代碼示例
- PHP ReflectionClass isTrait()用法及代碼示例
- PHP ReflectionExtension info()用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 ResetPassword。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。