01-Write CMS considerations

Source: Internet
Author: User

Original: 01-Write CMS considerations

1. Put the thinkphp core file in the project directory, and place the downloaded extension package in the Extend folder in the thinkphp directory

2. Set the encoding of the whole project to Utf-8

3. Create public directory to store public js,css,images, create index.php

1<?PHP2 Header("content-type:text/html; Charset=utf-8 "); 3 //The app_name and App_path subsections are used to define the project name and project directory, which typically refers to the project's directory name. 4 Define(' App_name ', ' Home ');5 Define(' App_path ', './home/'));6  //turn on debug mode, default is off7 Define(' App_debug ',true);8 //The app_name and App_path subsections are used to define the project name and project directory, which typically refers to the project's directory name. 9 require'./thinkphp/thinkphp.php ';Ten  One  A?>

admin.php

1<?PHP2 3 Header("content-type:text/html; Charset=utf-8 "); 4 //The app_name and App_path subsections are used to define the project name and project directory, which typically refers to the project's directory name. 5 Define(' App_name ', ' Home ');6 Define(' App_path ', './home/'));7  //turn on debug mode, default is off8 Define(' App_debug ',true);9 //The app_name and App_path subsections are used to define the project name and project directory, which typically refers to the project's directory name. Ten require'./thinkphp/thinkphp.php '; One  A  -?>

4, the config.inc.php of the common configuration

1<?PHP2 return Array(3 //-----------Database Configuration4' Db_type ' = ' mysql ',//Setting the database type5' db_host ' = ' localhost ',//setting up a host6' Db_name ' = ' thinkphp ',//Set database name7' Db_user ' = ' root ',//Set user name8' Db_pwd ' = ',//Set Password9' Db_port ' = ' 3306 ',//set the port numberTen' Db_prefix ' = ' tp_ ',//Set Table Prefixes One //' db_dsn ' + ' Mysql://root: @localhost: 3306/thinkphp ',//Configure database information using DSN mode to simplify database configuration A //-----------------End -  - //---Turn on page trace the' Show_page_trace ' =TRUE, - //' Config item ' = ' config value ' -' Url_pathinfo_depr ' = '/',//change the PathInfo parameter delimiter, default is/ - //Open URL is case-insensitive +' Url_case_insensitive ' =true, - //Modify left delimiter, default { +' Tmpl_l_delim ' = ' <{', A //Modify right delimiter, default} at' Tmpl_r_delim ' = '}> ', - ); -  -?>

When configuring foreground config.php, introduce

1<?PHP2 $config=include'./config.inc.php ';3 $confighome=Array(4     //' Config item ' = ' config value '5' User_auth_on ' =true,6 );7 return  Array_merge($config,$confighome);8?>

Debug whether the database is connected successfully

<? PHP class extends Action {    publicfunction  index () {        $m=m (' User ');         Var_dump ($m,Select ());    Failed returns  bool (false)        //$this->display ();     }}

5, inherit the public controller
Set the common character set to Utf-8

1<?PHP2     classCommonactionextendsaction{3      //The system action class provides an initialization method _initialize interface that can be used for extension needs, and the _initialize method executes first before all action method calls4         function_initialize () {5             Header("content-type:text/html; Charset=utf-8 ");6         }7     }8 9?>

The index module inherits the public

1<?PHP2 //This class is automatically generated by the system and is intended for testing purposes only3 classIndexactionextendscommonaction {4      Public functionindex () {5         $m=m (' use ');6         Var_dump($m-Select ());7         //$this->display ();8     }9}

01-Write CMS Considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.