Thinkphp 3.2.3 Experience

Source: Internet
Author: User
Tags drupal

Individuals still like TP more light than other PHP frames (only to Drupal, TP), and easy to get started (struts this action way, for Java programmers). The directory structure is also relatively simple to understand, some of the functions provided are also more practical. It's pretty easy for beginners, just a little disgusted with file naming XXXX.class.php, which feels a bit like the swearing-in writer is a Java practitioner. The default thinkphp template engine is also good and feels easier to get started than Drupal's theme function.

Key Directory Description

/index.php the entry file, the custom constants can be defined here.

/thinkphp directory is the core directory of TP, which includes directories such as Lib,mode,lang,conf,common, configuration, template processing and other related functions in the directory.

/application application directory, own application directory, common/common/function.php Public function definition file, common/conf/conf.php application configuration file (variable reference core directory conf/ convention.php),

Runtime directory will generate the appropriate runtime files, and some errors can be found by looking at the corresponding runtime files.


e.g entry file index.php

//Open Debug mode suggest the development phase to open the deployment phase comment or set to False
Define (' App_debug ', True);

Defining the App Catalog
Define(' App_path ', './application/');


Header("Content-type:text/html;charset=utf-8");

/** * Here the code is a custom of some constants begin***/
Define(' Web_path ', '/');//site Path
Define(' Web_name ', ' File Management system ');//Site name
Define(' Source_path ', '/resource/');//Data Path
Define(' Source_css_path ', Source_path. ') css/');//CSS Path
Define(' Source_js_path ', Source_path. ') js/');//JS Path
Define(' Source_img_path ', Source_path. ') Images/');//Picture Path
Define(' Upload_root ', ' UPLOAD ');//root directory file name
Define(' Upload_root_path ', ' e:/var/www.tp.com/'. Upload_root);//File creation Path
Define(' Page_size ', 13);//Paging Settings

e.g application configuration file

//' Config item ' = ' config value '
Using URL rewrite mode
' Url_model ' = 2,

//turn on page trace
' Show_page_trace ' =false,


/*Database Settings*/
' Db_type ' = ' mysql ',//Database Type
' db_host ' = ' localhost ',//Server Address
' Db_name ' = ' filesystem ',//Database name
' Db_user ' = ' root ',//User name
' Db_pwd ' = ',//Password
' Db_port ' = ' 3306 ',//Port
' Db_prefix ' = ' fs_ ',//database table Prefixes
' Db_params ' =Array(\pdo::attr_case = \pdo::case_natural),//Database Connection Parameters
' Db_debug ' =TRUE,//SQL log can be logged when database debug mode is turned on
' Db_fields_cache ' =false,//Enable field caching
' Db_charset ' = ' UTF8 ',//database encoding is UTF8 by default
' Db_deploy_type ' = 0,//Database Deployment method: 0 Centralized (single server), 1 distributed (Master-slave server)
' Db_rw_separate ' =false,//whether the database reads and writes separate master-slave valid
' Db_master_num ' = 1,//number of master servers for read-write separation
' Db_slave_no ' = ',//Specify the number from the server

/*Session Settings*/
' Session_auto_start ' =true,//whether to open session automatically
' Session_options ' =Array(' name ' = ' Session ',//Set Session name
' Expire ' = 3600*2,//Session Save 2 hours
' Use_trans_sid ' = 1,//cross-page delivery
' Use_only_cookies ' = 0,//whether to turn on the session mode of the cookie-based sessions only
),//session configuration array supports type name ID path expire domain parameters
' Session_type ' = ',//session hander type is not set by default unless the session hander driver is extended
' Session_prefix ' = ',//Session prefix

' Tmpl_cache_on ' =false,//default turn on template compilation cache false to recompile the template every time
' Action_cache_on ' =false,//Close Action Cache by default

Thinkphp 3.2.3 Experience

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.