Construction of thinkphp Project

Source: Internet
Author: User

Objective

 In doing javaweb development, we create a project, MyEclipse will automatically generate the corresponding directory structure for us, we do web development in this structure, when using the tinkphp Framework for PHP development, how do we generate a standard directory? In fact, Thinkphp has been implemented for us, we only need to do a few pages and request, we can do PHP development. First look at the environment I'm using.

    • WIN7 64BIT
    • wamp2.1
    • php5.3.3
    • MYSQL 5.5.8
    • Apache2.2.17
    • ThinkPHP3.2.3 full version
I.. thinkphp directory Structure

When we go to thinkphp website to download, we will find tinkphp Core Board, sample version and so on. We only need to download the core version when we do the development. The full version of the above is actually the core board of the bug that was modified. First look at the directory structure of the thinkphp.

The ThinkPHP3.2.3 we downloaded is extracted as shown below

  

The above directory is useful only tinkphp, because it is the core library, the others do not need, we will make changes later.

First look at the things in tinkphp, the hint can be deployed in a non-web directory, the WWW directory is to improve security

  

Second, construction works

Tinkphp introduced the idea of mvc+ modularity. MVC we are all familiar with, modularity is the application of isolation. For example, we develop a simple cloud computing encryption system. Our application name is Cloudcrypt, so there should generally be two modules in this application-the user module and the Administrator module. Specifically, there are two directories home and admin. Let's take a quick look at the next steps.

In the web development, we generally divided into two parts, respectively, is the front desk and backstage, the front desk is for users, and the latter is for the administrator management system. Below we will build these two systems through tinkphp.

After the result is generated, the admin stores the background page and the home directory holds the foreground page. The public directory holds common resources, such as CSS,JS, which are created manually.

Catalogue interpretation

  

Actual effect

  

The PUBLC is a public css,js picture and stuff like that.

    • Build your App

Create the index.php and edit as follows:

//Detecting PHP environmentsif(Version_compare(php_version, ' 5.3.0 ', ' < ') die(' Require PHP > 5.3.0! '));//Open Debug mode suggest the development phase to open the deployment phase comment or set to FalseDefine(' App_debug ',True);//define the app nameDefine(' App_name ', ' Cloudcrypt ');//define the app directory locationDefine(' App_path ', './cloudcrypt/'));//Introducing the thinkphp entry filerequire‘.. /.. /thinkphp/thinkphp.php ';

After the modification is done we open the server and access the PHP script file through the browser, then tinkphp will automatically generate a cloudcrypt directory for us, and also generate some files underneath.

    • index.php Path E:\wamp\www\thinkphp
    • thinkphp Path E:\wamp I'm going to cuff the frame right here.
    • Background directory

There is a home directory in the file you just generated, and we'll back it up and rename it as our backend module.

Of course, for the sake of security, tinkphp do not put in the WWW directory, because the directory of the file users are free to access. We should put it in a safe place (for example, I put it in the root directory of the Wamp so that the user is absolutely inaccessible). When we build our application, just write the location of the core file.

Development Manual URL

Construction of thinkphp Project

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.