此文件时入口文件index.php,此文件时入口文件index.php
2,//2表示是url重写模式 );return array_merge($dbconf,$conf);?>
与入口文件同级的有一个配置文件config.inc.php
'配置值' 'db_type'=>'mysql', 'db_host'=>'localhost', //数据库名 'db_name'=>'think', //数据库用户 'db_user'=>'root', //数据库密码 'db_pwd'=>'', //数据库端口 'db_port'=>'3306', //表前缀 'db_prefix'=>'t_', ) ?>
控制器indexaction.class.php
display(reg); } function add(){ if(md5($_post['verify'])!=$_session['verify']){ $this->error(验证码错误); } //实例化自定义模型 m('user')实例化基础模型 $user=d(user); if($user->create()){ //执行插入操作,执行成功后,返回新插入的数据库的id if($user->add()){ $this->success(注册成功); }else{ $this->error(注册失败); } }else{ //把错误信息提示给用户看 $this->error($user->geterror()); } } //生成图片验证码 function verify(){ /** * 在thinkphp中如何实现验证码 * * thinkphp已经为我们提供了图像处理的类库thinkphp\extend\... * * 如何导入类库? * 导入类库用import(文件路径)来导入,但是注意文件的路径中的\要替换成 . 号 * 1)导入系统的类库 import(从library开始算起) import('org.util.image')注意大小写 * 2)导入项目类库 import(@.org.image) 我们需要在我恩的项目的lib目录中存放 */ //导入图形处理类库 import(org.util.image); //import(@.org.image); //生成图形验证码 /* length:验证码的长度,默认为4位数 mode:验证字符串的类型,默认为数字,其他支持类型有0 字母 1 数字 2 大写字母 3 小写字母 4中文 5混合(去掉了容易混淆的字符ooll和数字01) type:验证码的图片类型,默认为png width:验证码的宽度,默认会自动根据验证码长度自动计算 height:验证码的高度,默认为22 verifyname:验证码的session记录名称,默认为verify */ //实现英文验证码 image::buildimageverify(4,1,'gif',60,22,'verify'); //实现中文验证码 //image::gbverify(); } }
模型usermodel.class.php
select from_unixtime(875996580);
-> '1997-10-04 22:23:00'
mysql> select unixtime_timestamp('1997-10-04 22:23:00');
-> '875996580'
http://www.bkjia.com/phpjc/1132202.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1132202.htmltecharticle此文件时入口文件index.php, 此文件时入口文件 index.php ?php//定义一下thinkphp框架存放的路径define('think_path','./thinkphp/');//定义当前的项目的名...