How does laravel's blade template generate static pages?

Source: Internet
Author: User
Baidu's php static technology has roughly three types: 1. replace the Page Template File with regular expressions. 2. use ob_star Technology 3. the third-party template engine was naive at the beginning, thinking that $ pageView (& #039; index & #039;) was directly used in the controller, and then saved $ page as a static page, then debug and release... baidu's php static technology has roughly three types:
1. Replace the Page Template File with regular expressions
2. Use ob_star Technology
3. Use a third-party template engine

At first it was naive to think that it was used directly in the controller.$page=View('index');Then$pageAfter debugging, I found that$pageIs an object, and no attribute records the generated html content.

Changed the ob_star technology, but added the first line of the blade Templateob_star(), Addob_get_contents()To get the page stream and write a file. The result is that the generated page is successfully written into the html file, but the page displayed in the browser is blank.

Static Solution .....

Reply content:

Baidu's php static technology has roughly three types:
1. Replace the Page Template File with regular expressions
2. Use ob_star Technology
3. Use a third-party template engine

At first it was naive to think that it was used directly in the controller.$page=View('index');Then$pageAfter debugging, I found that$pageIs an object, and no attribute records the generated html content.

Changed the ob_star technology, but added the first line of the blade Templateob_star(), Addob_get_contents()To get the page stream and write a file. The result is that the generated page is successfully written into the html file, but the page displayed in the browser is blank.

Static Solution .....

Resolution starts__toString()Triggered

Ob_start is used in the parsing process.

You can checkIlluminate\View\ViewThis class

You can also callIlluminate\View\ViewOf__toString()To generate a static page, as follows:


  __toString();

For laravel 5 (4 should be similar)

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.