Thinkphp Getting Started Tutorial (how to use thinkphp)

Source: Internet
Author: User
A popular and easy-to-understand thinkphp made in the mvc framework. its functions are relatively powerful and many rules have been defined for us to facilitate our development.

A popular and easy-to-understand thinkphp made in the mvc framework. its functions are relatively powerful and many rules have been defined for us to facilitate our development, this tutorial is suitable for beginners to learn from a large number of visual screens or open-source code. let's take a look at thinkphp tutorials today.

First of all, we will install thinkphp. this is not much to explain. the official document of the entrance file only needs to be run once.

Next let's run the instance: First, create an IndexAction. class. php simple instance in the action, and write a few simple lines of output statements without being too complicated.

// This document is automatically generated for testing only
Class IndexAction extends Action
{
/**
+ ----------------------------------------------------------
* Default operation
+ ----------------------------------------------------------
*/
Public function index (){

$ This-> assign ('title', 'php hobby ');
$ This-> assign ('keyword', 'php development experiences, php source code sharing ');
$ This-> display ();
}

}
?>

Of course, we also need it in the model File. you can leave some complicated code in it, but you must reference it. why not use mvc, it can or cannot be achieved through model in many complex development processes.

IndexModel. class. php

Class IndexModel extends Model {

}

?>

Next, create an index directory under the Tpl \ default directory. this is the directory where we store the template.

Put your template page inside





{$ Title}


In this way, I will try to see if we can run our template. the principles of this template will be discussed in mvc later.

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.