PHP Framework Three (view)
In the previous section we simply implemented the controller. In this section we implement a view.
This view is very simple. The main use is Ob_start (), ob_get_content (); This file is located in the includes folder
view.php
For the OB function, we can simply assume that after PHP is compiled, it does not return to the page immediately, but rather first to the buffer.
The above view just makes a simple implementation, if we want to extend it, we can improve the Set_view_type () method, can also increase the cache, also can increase the support of the template.
Concrete implementation I will add in a later chapter, today we try to use this view.
or the index.php file under the Controller folder yesterday
' HELLO World ');}}
Then create a new default folder within the View folder, and then create a new index.htm
We run the site and we can see the results, "HELLO world".
I think the result is a testimony to the new ideas of every programmer.
If in this file you also want to insert the head, or the tail, just create a new head.htm. And then join in the index.htm.
It is possible to join the public sector.
At this point, our small view class is implemented.
We can go to the experiment on our own, if not, we communicate again.
The next section is the DAO layer that I used to introduce in my blog, namely modules.