ThinkPHP3.2.2: Take a look at the first example of the running process

Source: Internet
Author: User

The first time to learn PHP framework, check, it is said that the Laravel market occupies the highest, but can not be installed AH. Need to use the cmd under the HTTPS download, all kinds of masts software is used, can not be used, pit dead. By Baidu, the domestic PHP framework is said to thinkphp heat is very high, from the thinkphp main station http://www.thinkphp.cn/read a half-day tutorial also did not read, their own groping it. Record the running process of the first example to prevent forgetting later.

1, install Wampserver, to D:\wamp\.

2, download ThinkPHP3.2.2 core edition. After decompression, drop to D:\wamp\www\MyWeb\. Open the browser, enter the URL: http://localhost/MyWeb/

Show:

:)

Welcome to use thinkphp!

[You are now visiting the index controller of the home module]

3. Build tables and insert data into MySQL's thinkphp database and run SQL with Wamp built-in phpMyAdmin:

CREATE TABLE IF not EXISTS ' Think_data ' (

' ID ' int (8) unsigned not NULL auto_increment,

' Data ' varchar (255) is not NULL,

PRIMARY KEY (' id ')

) Engine=myisam DEFAULT Charset=utf8;

INSERT into ' think_data ' (' id ', ' data ') VALUES

(1, ' thinkphp '),

(2, ' php '),

(3, ' framework ');

4, modify the database configuration parameters, open: D:\wamp\www\MyWeb\Application\Common\Conf\config.php:

<?php

Return Array (

' Config item ' = ' config value '

Adding database configuration information

' Db_type ' = ' mysql ',//database type

' db_host ' = ' localhost ',//server address

' Db_name ' = ' thinkphp ',//database name

' Db_user ' = ' root ',//user name

' Db_pwd ' and ' = ',//password

' Db_port ' = 3306,//Port

' Db_prefix ' = ' think_ ',//database table prefix

);

5, modify D:\wamp\www\MyWeb\Application\Home\Controller\IndexController.class.php:

<?php

namespace Home\controller;

Use Think\controller;

Class Indexcontroller extends Controller {

Public Function index () {

$Data = M (' Data '); Instantiate the data model

$this->data = $Data->select ();

$this->display ();

}

}

6. Create folder Index under Folder D:\wamp\www\MyWeb\Application\Home\View, then build file index.html:

<title>select data</title>

<body>

<volist name= "Data" id= "VO" >

{$vo. id}--{$vo .data}<br/>

</volist>

</body>

Okay, here we go. Browse http://localhost/MyWeb/again:

Show:

1--thinkphp

2--php

3--framework

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.