Preliminary understanding of thinkphp

Source: Internet
Author: User

The meaning of the framework
Reduce repetitive labor
Facilitates team collaboration
Enhanced security
Work / interview is required

Why Study thinkphp
Domestic companies use a lot of
The framework is basically an MVC architecture that learns a

I. Deployment of the framework

1.1 Download TP official website

  http://www.thinkphp.cn/

1.2 Introduction

A: unzip file
B:  get thinkphp directory ( As long as this can )
C:thinkphp can be placed in any directory ( not necessarily www "
D:  Build the project shop, CMS, Blog etc
E:  project directory , create index.php

index.php content is as follows

// define the application directory define('app_path','./'); // Introducing the thinkphp entry file ' .. /thinkphp/thinkphp.php';

1.3 Build Project

   After the configuration of the 1.2 is completed ,
automatically generate projects when you run index.php at addresses
See the following interface , the configuration is successful

Welcome to use thinkphp!

  

  after success , The following directories are automatically generated

Common// Library , classes and so on can be here
Home//controll Model View It's all here.
Runtime// run-time generated files

1.4 Creating a Module

  what is a module : 1 a website , Common front Desk , admin Backstage , Both functions , CSS, pictures, etc. , It's a big difference. .

Development Time , for clarity , can be divided into 2 a module to manage .

  Copy directly Home Module

and rename it to Admin

    


Modify Admin/controller/indexcontroller the namespace

PHP namespace Home\controller; modified to php namespace Admin\controller;

  

<? phpnamespace Admin\controller;  Use Think\controller; class extends Controller {    publicfunction  index () {       echo ' Admin ';    }} 

Address bar Access /index.php/admin/index/index

Represents the module creation success!

Preliminary understanding of thinkphp

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.