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