The controller is implemented in the previous section of PHP framework 3 (view. In this section, we implement the view. This view file is very simple. This file mainly uses ob_start (), ob_get_content (); this file is located in view. php & lt ;? Phpclass PHP framework 3 (view)
In the previous section, we implemented the controller. In this section, we implement the view.
This view file is very simple. Ob_start () and ob_get_content () are mainly used. This file is located in the Des folder.
View. php
For OB functions, we can simply think that after PHP compilation, it will not immediately return to the page, but will first put it in the buffer zone.
The preceding view is just a simple implementation. if we want to extend it, we can improve the set_view_type () method, increase the cache, and increase the template support.
For specific implementation, I will add it in a later chapter. today we will try to use this VIEW.
Or the index. php file in the controller folder yesterday
'HELLO WORLD'));}}
Then create a new ultultfolder in the viewfolder, and then create an index.htm
When we run the site, we can see the result "hello world ".
I think this result is a witness of every programmer's new thoughts.
If you want to insert the header or tail part in this file, you only need to create a new head.htm. Then add it to index.htm.
The public part can be added.
So far, we have implemented this small View class.
You can experiment on your own. if not, let's talk about it again.
The next section is the DAO layer I previously introduced in the BLOG, namely, MODULES.