MVC is the abbreviation for model-View-controller
Controller is very important, functional things to rely on it to achieve, model I have not touched, only know it is responsible for the database, like a big control bar ...
Speed...
A website plainly or to the user to see the view, then the controller can control the view ...
The controller is inside the D:\WWW\myapp\Index\Lib\Action.
The entry file is index.php
<? PHP Define // Project name Define // Project Path Define (' App_debug ',TRUE// turn on debug mode include // introducing the thinkphp core file ?>
Controller file is IndexAction.class.php
<? PHP // This class is automatically generated by the system and is intended for testing purposes only class extends Action { publicfunction index () {
echo ' Hello World ';
//echo C (' username ');
} }
Browser input http://localhost/myapp/
Show: Hello World
Now that you can display the page with Hello World, don't worry ...
I changed echo ' Hello World ' to echo C (' username ');
C is the abbreviation for config
Enter D:\WWW\myapp\Index\Conf Open config.php
edited into
<? PHP return Array ( //' config item ' = = ' config value' // Assignment value ); >
Controller to display the username in the configuration, in the configuration, username assigned to the admin
So http://localhost/myapp/show admin
The sentence to introduce the template is
$this->display ()
Display is the meaning of the exhibition, just Baidu translated ...
Go on...
Directly put $this->display () into the controller error, said I have a problem with the controller
A split symbol is added less.
Because that's the way it is.
$this->display ();
Now the report of the mistake is very optimistic, said I do not exist template [./index/tpl/index/index.html]
What do you need to add?
Index.html inside is very simple, just a word, 123
Refresh the display after 123
Baidu Home Template
A brain of the home page CSS what all copied to index
Refresh after the discovery of CSS, JS What did not introduce in
Apparently, it has its own rules.
Baidu a bit
Okay, I'll put it in here and try D:\WWW\myapp\public.
Since the path has changed, then the template home page should also be changed accordingly
My editor has a replacement function, so much more ...
./Replace All to __public__/
OK, save it.
Refresh See effect
Very good
A full page is coming out.
Unfortunately I still do not understand MySQL, seriously learn to come back to add data ...
The concept of MVC and the grammatical features of thinkphp thinkphp introducing templates