本文整理匯總了PHP中CommonUtil::is_email方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::is_email方法的具體用法?PHP CommonUtil::is_email怎麽用?PHP CommonUtil::is_email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::is_email方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setCampaignEmailAddressAction
/**
* Adds an email address action to campaign.
* @param integer $campaignId
* @param string $email
* @return Campaign|HttpResponse|null
* @throws ErrorException
*/
public function setCampaignEmailAddressAction($campaignId, $email)
{
$resource = "/campaigns/";
if (is_null($campaignId)) {
throw new ErrorException("Parameter 'campaignId' cannot be null");
} elseif (!is_int($campaignId)) {
throw new ErrorException("Parameter 'campaignId' must be an integer");
}
if (is_null($email)) {
throw new ErrorException("Parameter 'email' cannot be null");
} elseif (!is_string($email)) {
throw new ErrorException("Parameter 'email' must be a string");
} elseif (!CommonUtil::is_email($email, true)) {
throw new ErrorException("Parameter 'email' must be a valid email address");
}
try {
$params = array();
$params["address"] = $email;
$resource .= "/{$campaignId}/actions/email";
$response = $this->httpClient->post($resource, $params);
if ($response instanceof HttpResponse) {
if ($response->getStatus() === HttpStatusCode::HTTP_OK) {
$json = JsonHelper::getJson($response->getBody());
if (isset($json)) {
return new Campaign($json);
}
} else {
return $response;
}
}
} catch (Exception $ex) {
echo $ex->getTraceAsString();
}
return null;
}