phpcms建立后台项目与验证码调用
后台映射地址;’TMPL_PARSE_STRING'=>array(
‘/Public’=>.’/’. APP_NAME.’/TpL/Admin/Public’,
验证码数据表
mysql> create table hd_user(id int unsigned not null primary key auto_increment,username char(20) not null default'',password c har(32) not null default'',logintime int(10) unsigned not null,loginip varchar(30) not null,'lock' tinyint(1) unsigned not nul1 default 0,unique(username))engine myisam default charset utf8;
验证码login方法
Class LoginAction extends Action{
Public function index(){
$this->display();
}
Public function verify(){
import('0RG.Util.Image');
Image::buildImageVerify(4,5,'png',180,125);
}
}
前台验证码不显示解决方法
<input type="code"class="len250"name="code"/><img src="{:U('Admin/Login/verify')}" id="code"/> <a href="
javascript:void(change_code(this));">看不清</a>
<script type="text/javascript">
var verifyURL='{:U("Admin/Login/verify",",'")}';
function change_code(obj){
$("# code"). attr("src", verifyURL+'/'+Math. random()); return false;}