PHP framework 3 (view)

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.