How to expand the use of compressed package details
1: Unzip the expansion pack: Thinkphp3.1.2_extend.zip and copy all the \extend files under it
2: Put the copied files into the project E:\wamp\www\thinkphp\ThinkPHP\Extend (this is empty file when installed), your own project directory
Can
============================= below is the use of the verification code in the expansion package ========================================
For example, use the verification code of the extension package: (see Manual--miscellaneous)
In: E:\wamp\www\thinkphp\Home\Lib\Action\ NEW: PublicAction.class.php code is as follows--must be added
Generate verification code directly using code
Class Publicaction extends action{//follow the manual instructions.
Function Code() {
Import (' ORG. Util.image ');
Image::buildimageverify ();
}
}
//Directory/thinkphp/index.php/public/code Click the Transform Verification code onclick
Foreground template page Call verification code:
to generate verification code
All HTML login pages
<form action= ' __url__/do_login ' method= ' post ' name= ' MyForm ' >
User name: <input type= ' text ' name= ' username '/><br/>
Password: <input type= ' password ' name= ' password '/><br/>
CAPTCHA: <input type= ' text ' name= ' code '/>
</br/>
</form>
Login Verification Code Plus: LoginAction.class.php (module)
ClassloginactionExtends Action {
function Do_login () {
Get the user name and password, and so on. And in the database, there is a user allowed to log on otherwise output error page
$username =$_post[' username '];
$password =$_post[' password '];
$code =$_post[' code '; input box; <input type= ' text ' name= ' code '/>
if ($_session[' verify ']!==md5 ($code)) {
$this->error (' Authenticode Error! ‘);
}
$m =m (' User ');
$where [' username ']= $username;
$where [' Password ']= $password;
$i = $m->where ($where)->count ();
if ($i >0) {
$this->redirect (' User/index ');
}else{
$this->error (' The user does not exist ');
}
}
}
thinkphp Framework Extension Package Usage details--Verification code example (11)