can php files be converted to HTM?

Source: Internet
Author: User
A good parameter php file, want to get the final display of the HTM file, in the background how can do?


Reply to discussion (solution)

Save the results of the PHP program output to a file

Save the results of the PHP program output to a file



What do you do in the background? Could you elaborate on that, please?

Like a PHP

    
 
              <?php echo $title;? >        


Other PHP files are also included, $title set in other files, and other include files

What do I do if I want to get the HTM file from the last browser?

Ob_start (' HTML ');
function html ($s) {
File_put_contents (basename ($_server[' php_self '). '. htm ', $s);
}
//......

Using the template engine

What does LZ mean by "display"?
If the client display code is in HTML format, then PHP simply uses echo.
If the client sees a URL that is an HTML extension, it can be used pseudo-static or directly in Apache to specify PHP parsing *.html

What does LZ mean by "display"?
If the client display code is in HTML format, then PHP simply uses echo.
If the client sees a URL that is an HTML extension, it can be used pseudo-static or directly in Apache to specify PHP parsing *.html



For example, I now have a a.php?p1=a&p2=b, I want to generate an HTM file that shows the contents of the previous PHP file with the parameters.

Just want to get a browser like PHP as the effect of the HTM, I would like to have done a bit of guidance

The moderators have already said
You check these 3 functions Ob_start ob_get_contents file_put_contents

echo file_get_contents (' http://www.domain.com/index.php?action=xxx '); Get the generated HTML directly

Generate an HTM file when calling A.php?p1=a&p2=b, then you can access the page with the HTM directly, see # #
Call a.php?p1=a&p2=b directly display the HTM file page, the direct echo

Are you trying to say, pseudo-static?

Rewrite ^ (. *)/index_ (\d+) _ (\d+) _ (\d+). html$ $1/index.php?val1=$2&val2=$3&val3=$4 last;

This is mainly to transform/index.php?val1=121&val2=222&val3=232 into/index_121_222_232.html form.

You use IE (Chrome) to open the PHP site, do not want to see HTML is not.

Rewriteengine on
AddType application/x-httpd-php. html. htm

Use
Htaccess, use the above statement to change all PHP to a static suffix.

  • Related Article

    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.