Home > Backend Development > PHP Tutorial > 注册时错误提示

注册时错误提示

WBOY
Release: 2016-06-23 14:28:22
Original
1057 people have browsed it

if($ucresult > 0)            {                echo "<font color='#4E7504'><b>√用户名可用</b></font>";            }            elseif($ucresult == -1)            {                echo "<font color='red'><b>&times;用户名不合法</b></font>";            }            elseif($ucresult == -2)            {                echo "<font color='red'><b>&times;包含要允许注册的词语</b></font>";            }            elseif($ucresult == -3)            {                echo "<font color='red'><b>&times;用户名已经存在</b></font>";            }            exit();
Copy after login
Copy after login

像这种 -1 -2 -3 他是怎么来的?


回复讨论(解决方案)

if($ucresult > 0)            {                echo "<font color='#4E7504'><b>√用户名可用</b></font>";            }            elseif($ucresult == -1)            {                echo "<font color='red'><b>&times;用户名不合法</b></font>";            }            elseif($ucresult == -2)            {                echo "<font color='red'><b>&times;包含要允许注册的词语</b></font>";            }            elseif($ucresult == -3)            {                echo "<font color='red'><b>&times;用户名已经存在</b></font>";            }            exit();
Copy after login
Copy after login

像这种 -1 -2 -3 他是怎么来的?
下面是html代码
  <tr>    <td class="textR"><span class="f14">手机号码</span>:</td>    <td><input type="text"  name="mobile" class="txtInput" id="mobile"></td>    <td class="color999"><span class="red">*</span><span id="_mobile"></span></td>  </tr>
Copy after login

这段代码不完整,前面应该还有获取和转换的代码

如果用的是ajax,那就是请求界面的返回值

这可能是程序规范的返回值 约定俗成 所以要往上看这个$ucresult 是如何赋值的

这可能是程序规范的返回值 约定俗成 所以要往上看这个$ucresult 是如何赋值的

function uc_user_checkemail($email) {	return call_user_func(UC_API_FUNC, 'user', 'check_email', array('email'=>$email));}
Copy after login
Copy after login

define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post');
Copy after login
Copy after login

function uc_api_mysql($model, $action, $args=array()) {	global $uc_controls;	if(empty($uc_controls[$model])) {		include_once UC_ROOT.'./lib/db.class.php';		include_once UC_ROOT.'./model/base.php';		include_once UC_ROOT."./control/$model.php";		eval("\$uc_controls['$model'] = new {$model}control();");	}	if($action{0} != '_') {		$args = uc_addslashes($args, 1, TRUE);		$action = 'on'.$action;		$uc_controls[$model]->input = $args;		return $uc_controls[$model]->$action($args);	} else {		return '';	}}
Copy after login
Copy after login


这可能是程序规范的返回值 约定俗成 所以要往上看这个$ucresult 是如何赋值的

function uc_user_checkemail($email) {	return call_user_func(UC_API_FUNC, 'user', 'check_email', array('email'=>$email));}
Copy after login
Copy after login

define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post');
Copy after login
Copy after login

function uc_api_mysql($model, $action, $args=array()) {	global $uc_controls;	if(empty($uc_controls[$model])) {		include_once UC_ROOT.'./lib/db.class.php';		include_once UC_ROOT.'./model/base.php';		include_once UC_ROOT."./control/$model.php";		eval("\$uc_controls['$model'] = new {$model}control();");	}	if($action{0} != '_') {		$args = uc_addslashes($args, 1, TRUE);		$action = 'on'.$action;		$uc_controls[$model]->input = $args;		return $uc_controls[$model]->$action($args);	} else {		return '';	}}
Copy after login
Copy after login
 $ucresult = uc_user_checkemail($email);
Copy after login

这可能是程序规范的返回值 约定俗成 所以要往上看这个$ucresult 是如何赋值的 妞妞  你说我不懂这些类什么的东东。是不是说我是个水货程序员?懂是懂点,但是就是不会写

约定俗成的数值啦
你得看看常量UC_API_FUNC的值的同名函数
把'user', 'check_email', array('email'=>$email) 三个传进去会有什么结果
可能还要向上追溯

uc 的api 和函数 查他们的手册吧 应该有提到的

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template