This file when the portal file index.php,
This file when the portal file index.php
conf/config.php
' Config value ' Url_model ' =>2,//2 means URL rewrite mode); return Array_merge ($dbConf, $Conf); >
There is a configuration file with the portal file sibling config.inc.php
' Config value ' ' db_type ' = ' mysql ', ' db_host ' = ' localhost ',//database name ' db_name ' + ' think ',//database user ' Db_user ' + ' root ',/ /Database Password ' db_pwd ' + ',//Database port ' db_port ' = ' 3306 ',//table prefix ' db_prefix ' = ' t_ ',)?>
Controller IndexAction.class.php
Display ("Reg"); }function Add () {if (MD5 ($_post[' verify ')) {!=$_session[' verify ']) {$this->error ("Authenticode Error");}//Instantiate custom Model M (' User ') Instantiate the underlying model $user=d ("user"), if ($user->create ()) {//performs the insert operation, after execution succeeds, returns the ID of the newly inserted database if ($user->add ()) {$this->success ("registered Success");} else{$this->error ("registration Failed");}} else{//the error message to the user to see $this->error ($user->geterror ());}} Generate Picture Captcha function verify () {/** * How to implement CAPTCHA in thinkphp * * thinkphp has provided us with an image processing class library thinkphp\extend\ ... * * How do I import a class library? * Import the class library to import with "import (file path), but note the path of the file in the \ to replace." ("* 1) Import the class library of the system (starting from the library) import (' ORG. Util.image ') Note case * 2) Import the Project class libraries import ("@.org. Image ") We need to store the *///Import Graphics class library (" ORG ") in the Lib directory of my Grace project. Util.image ");//import (" @.org. Image ");//Generate a graphics verification code//Length: Verification code, default is 4 digits mode: The type of the validation string, the default is a number, the other support type has 0 letters 1 digits 2 Capital Letter 3 Lowercase Letter 4 Chinese 5 Mix (remove the easily confusing characters Ooll and the number 01) Type: The name of the image of the verification code, the default is PNG width: The size of the verification code, the default is automatically calculated according to the length of the verification code: the height of the verification code, the default is 22verifyName: The name of the session record of the verification code, the default is verify */// Implement English Code image::buildimageverify (4,1, ' gif ', 60,22, ' verify ');//implement Chinese Code//image::gbverify ();}}
Model UserModel.class.php
{return false;} Else{return true;}} Returns the IP address of the visitor function GetIP () {return $_server[' remote_addr '];} function Shijian () {return date ("y-m-d h:i:s");}}
Template reg.html
Registered
If you do not understand the place, you can give me a message, I will answer your questions in detail, thank you for your attention
The directory structure is as follows
Tp
--------thinkphp Folder
--------protal.php This file is called protal.php.
When running protal.php, the thinkphp Welcome page appears, proving that it has been configured successfully and that the directory results change
The directory at this time is
Tp
--------thinkphp Folder
--------protal.php Entry file (the file above)
--------Protal Folder
The resulting project directory structure is similar to the system directory, including:
Common |
Common functions for Project public files directory, general placement of items |
Conf |
Project configuration directory, all the configuration files of the project are put here |
Lang |
Project Language Pack directory (optional if multiple language support is not required to delete) |
Lib |
Project class library catalogs, usually including action and model subdirectories |
Tpl |
Project template catalog, Support Template theme |
Runtime |
The Project runtime directory, which includes the cache (template cache), Temp (data cache), data directory, and logs (log file) subdirectories, are first grouped if there is a grouping. |
Mysql> 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.html www.bkjia.com true http://www.bkjia.com/PHPjc/1132202.html techarticle This file when the portal file index.php, this file when the portal file index.php? php//define the path that the thinkphp framework holds define (' Think_path ', './thinkphp/');//define the name of the current project ...