Sleep related problems sooner or later become a little brother my top headache related issues. Php

Source: Internet
Author: User
Sleep problems have become my top headache problem sooner or later ... -php

Hi

Last night to make himself, not sleep well the whole person is not good ...

1, PHP implementation of the page static

Second, pure static

2.2 Realization of the principle of pure static page

--Basic mode

File_put_contents () function;

Using the PHP built-in caching mechanism, output_buffering.

Specific information can be found in the PHP manual. Focus on function format, parameter, return value.

--Chestnut file_put_contents ()

/*
* Write function
*/

File_put_contents (' index.shtml ', ' asdklfj ');

Run http://localhost/phpJingtaihua/index.shtml to get results. A very simple function.

--Chestnut output_buffering

There are built-in functions,OB (output_buffering) series.

Mainly involving four

Ob_start, open the output control buffer;

Ob_get_contents, returns the output buffer contents;

Ob_clean, emptying the output buffer;

Ob_get_clean, gets the buffer contents and deletes the current output buffer.

Ob_start (); Open buffer
echo 1234;
Echo ob_get_contents ();

Get a sequence of 12341234. That is, all the output is going through the buffer-it's like having a filter on the faucet.

Ob_start (); Open buffer
Echo 111;echo "
";
Echo ob_get_contents (); echo "
";
Ob_clean ();
Echo ob_get_contents (); echo "
";

Echo 222;echo "
";

Echo Ob_get_clean (); echo "
";

Here, 111 because the buffer clears, and no longer outputs, even the original echo statement.

2.3 Pure Static Case Implementation Introduction

The ultimate goal is to generate static files.

One is to write the data to a static file.

Secondly, the OB mechanism is used to obtain data (which can be written to a static file).

2.4 Case Implementation Steps

Link the database, get the data from the database--"fill in the data to the template file-" The dynamic page into a static page, generate a pure static file.

-----------------

First, there is time to write again in the evening ....

  • 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.