本文整理汇总了PHP中Regex::match方法的典型用法代码示例。如果您正苦于以下问题:PHP Regex::match方法的具体用法?PHP Regex::match怎么用?PHP Regex::match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Regex
的用法示例。
在下文中一共展示了Regex::match方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxSendEmailAction
public function ajaxSendEmailAction()
{
$email = Request::getPOST('email');
$verify = Request::getPOST('verify');
if (empty($verify)) {
$this->renderAjax(1, '请输入图片验证码!');
}
if (empty($email)) {
$this->renderAjax(1, '请填写邮箱!');
}
// 校验验证码
$imgCode = Session::get('check_code');
if (strtolower($verify) != $imgCode) {
$this->renderAjax(2, '图片验证码错误!');
}
if (!Regex::match($email, RegexVars::EMAIL)) {
$this->renderAjax(1, '邮箱格式错误!');
}
// 是否存在
$userInfo = UcUserInterface::getByLoginName(array('login_name' => $email));
if (empty($userInfo)) {
$this->renderAjax(1, '用户邮箱不存在!');
}
$code = UcAuthInterface::sendEmailCode(array('email' => $email, 'repeat_at' => time() + 60));
if (false === $code) {
$this->renderAjax(1, '服务器繁忙,请1分钟后重试!');
}
$this->renderAjax(0);
}
示例2: ajaxSubmitAction
public function ajaxSubmitAction()
{
$username = Request::getPOST('username');
$password = Request::getPOST('password');
$verify = Request::getPOST('verify');
if (!Regex::match($username, RegexVars::USERNAME)) {
$this->renderAjax(1, '用户名格式不正确!');
}
// 校验密码格式
if (!Regex::match($password, RegexVars::PASSWORD)) {
$this->renderAjax(1, '密码长度为6-20位!');
}
// 校验验证码
$code = Session::get('check_code');
if (strtolower($verify) != $code) {
$this->renderAjax(1, '验证码错误,请重试!');
}
// 过滤用户名
if (false !== strpos(strtolower($username), 'admin')) {
$this->renderAjax(1, '用户已经存在!');
}
// 校验用户是否存在
$userInfo = UcUserInterface::getByLoginName(array('login_name' => $username));
if (!empty($userInfo)) {
$this->renderAjax(1, '用户名已经被占用!');
}
// 保存
$data = array('username' => $username, 'password' => $password, 'reg_ip' => Http::getClientIp());
UcUserInterface::save($data);
$this->renderAjax(0);
}
示例3: getController
private static function getController($location)
{
$location = strtolower($location);
$pattern = '/controller/';
$match = Regex::match($pattern, $location);
if ($match > 0) {
$location = Regex::replace($pattern, '', $location);
}
return $location;
}
示例4: ajaxUpdatePasswordAction
public function ajaxUpdatePasswordAction()
{
// 获取参数
$oldPassword = Request::getPOST('old-password');
$password = trim(Request::getPOST('password'));
if (!Regex::match($password, RegexVars::PASSWORD)) {
$this->renderError('新密码限制为6-20位!');
}
$encryptPassword = UserCommonInterface::encryptPassword(array('password' => $oldPassword));
if ($encryptPassword != $this->loginUserInfo['password']) {
$this->renderError('旧密码不正确!');
}
$data = array('id' => $this->loginUserInfo['id'], 'password' => $password);
UserCommonInterface::save($data);
UserCommonInterface::logout();
$this->renderAjax(0);
}
示例5: ajaxSendEmailAction
public function ajaxSendEmailAction()
{
$email = Request::getPOST('email');
if (empty($email)) {
$this->renderError('请填写邮箱!');
}
if (!Regex::match($email, RegexVars::EMAIL)) {
$this->renderError('邮箱格式错误!');
}
// 是否已经被绑定
$userInfo = UserCommonInterface::getByLoginName(array('login_name' => $email));
if (!empty($userInfo)) {
$this->renderError('该邮箱已经被绑定!');
}
$code = AuthCommonInterface::sendEmailCode(array('email' => $email, 'repeat_at' => time() + 60));
if (false === $code) {
$this->renderError('服务器繁忙,请1分钟后重试!');
}
$this->renderAjax(0);
}