Process Control for the Thinkphp framework-Request View page
Thinkphp Framework today to see a bit, feel really more convenient than Zend, the reason not to see Zend, is because I was unbearable, the difficulty is too big, so that I one hours of the video saw six times also did not understand, such words, the back of the things I will not be able to carry out, because the connection between the big, So, simply follow the progressive, the thinkphp study, and then over to Zend, sure enough, after learning, found thinkphp frame than Zend
A lot simpler, on the one hand is his relatively simple configuration, knowledge is just the configuration of the virtual host can be, this is difficult to imagine in Zend, in addition, the method of the call is relatively convenient, because it is not as bad as the Zend package so you can not find the reason, and then is the directory structure is very clear, Directly into the library file can directly invoke the method, such as only the display () method can take the call view page, there is a good extensibility, not like Zend almost a move cannot move, but TP also has shortcomings, his advantage is his shortcomings, although convenient, But the power of the function is indeed inferior to Zend, which must be admitted, therefore, TP can be regarded as a zend transition tutorial.
So, what is the think of the running process?
First of all, hit us to build a good virtual host and all the directories are ready to complete, if the request site name, first presented to us is the TP welcome interface, immediately thereafter, you will find all things such as directory all give you configuration complete, this is very important, including the model to try to controller, etc. And then I'm going to test the test of the bar view.
Call The View page is very simple, so that we build in the controller you want to build in the view of the file name of the controller files (very around the mouth, the instance to understand), but must not forget to inherit the controller class, so as to continue to go on, with the display () method to request the view corresponding page, so , very simple to complete the view of the display, the whole idea of layering is also revealed.
However, I encountered some problems during the specific test:
The first is the path problem, learning Zend on the path problem to get stuck, because I just do not understand why my files can not use the rewrite mechanism, but in TP inside, become clear, because TP divides the path into four kinds: Get path mode, full path mode, rewrite path mode, and compatible path mode, Here I just chose the Get path mode to test, but to modify the configuration file, you have to go to the config.php to modify, do not go to the system to modify, just like the following in config:
Return Array (
' Config item ' = ' config value '
Set to a compatible path mode
' Url_modle ' = 3,
Setting Display debugging Information
' Show_page_trace ' = true,
URL insensitive settings
' url_case_insensitive '= True,
);
This is the path of the problem encountered, but also the introduction of external files;
With regard to this, there is no explanation of the right and wrong, just the convenience and specification of the problem, I am so suggesting that external files such as CSS. Js,image such as the absolute path of the way to display, on the one hand fast and accurate, on the other hand easy to modify.
You can set the constant address in the index portal file:
Define ("Site_url", "http://mytest.com/");
Define ("Css_url", Site_url. " public/css/");
Define ("Js_url", Site_url. " public/js/");
Define ("Image_url", Site_url. " public/js/");
This can be introduced when the view is introduced:
Finally, there is a suggestion is to open the development model, conducive to their own clear understanding of information, easy to debug:
Define ("App_debug", true);//adjustment becomes development mode