How to generate a static page

Source: Internet
Author: User
Say


      Require_once (' gongxiang.php ');
      $con = Lianjie ();

      $result = mysql_query ("SELECT * from Tupianwenzi LEFT join detail on tupianwenzi.xiaofenleiindex = Detail.xiaofenleidetail ");

      while ($row = Mysql_fetch_array ($result))
      {






      Echo




    • '. $row [' Xiaofenleiindex ']. '
      '. $row [' Detailindex ']. '

    • ';

      }
      ?>
      Mysql_close ($con);
      ?>




How does this code generate static pages the best and fastest


Reply to discussion (solution)

No solution ... Can't generate

Can't generate?????

I think the final page source code directly copied out the fastest, ah, PHP has no such wording.

At the beginning of the file to join

 
  

function callback ($buffer) {
File_put_contents (' 111.html ', $buffer);
return $buffer; No need to display the contents of the page to return ';
}
Ob_start ("callback");
?>
echo ' Wee ';
?>

This write does not generate 111.html

function callback ($buffer) {
File_put_contents (' 111.html ', $buffer);
return $buffer; No need to display the contents of the page to return ';
}
Ob_start ("callback");
?>
echo ' Wee ';
?>

This write does not generate 11 ...
You have to quote this function, this custom function must not be used.

function callback ($buffer) {
File_put_contents (' 111.html ', $buffer);
return $buffer; No need to display the contents of the page to return ';
}
Ob_start ("callback");
?>
echo ' Wee ';
?>

This write does not generate 11 ... Oh, PHP has been changed beyond recognition.
Add a parameter
Ob_start ("callback", Php_output_handler_start);
No, it wasn't.



Reference 5 Floor AAA86965921AAA reply: function callback ($buffer) {
File_put_contents (' 111.html ', $buffer);
return $buffer; No need to display the contents of the page to return ';
}
Ob_start ("callback");
?>
EC ...

$buffer parameters to write what can be used for me.

That's it, passed the test.

function callback ($buffer) {  file_put_contents (' The filename you need ', $buffer);  return $buffer; No need to display the contents of the page return ';} Ob_start ("callback", Php_output_handler_start);

This line, has passed the test
PHP Code?12345function callback ($buffer) {file_put_contents (' You need the filename ', $ Buffer); return $buffer; No need to display the contents of the page return ';} Ob_start ("callback", Php_output_handler_start);
...



Yes, but I changed to
!--? PHP
function Callback ($buffer) {
file_put_contents (' 111.html ', $buff ER);
return $buffer;//No need to display the contents of the page return ';
}
Ob_start ("callback");
?>



      Require_once (' gongxiang.php ');
      $con = Lianjie ();

      $result = mysql_query ("SELECT * from Tupianwenzi LEFT join detail on tupianwenzi.xiaofenleiindex = Detail.xiaofenleidetail ");

      while ($row = Mysql_fetch_array ($result))
      {






      Echo




    • '. $row [' Xiaofenleiindex ']. '
      '. $row [' Detailindex ']. '

    • ';

      }
      ?>
      Mysql_close ($con);
      ?>



It's not.

Can not be generated can not generate

function callback ($buffer) {
File_put_contents (' 111.html ', $buffer);
return $buffer; No need to display the contents of the page to return ';
}
Ob_start ("callback", Php_output_handler_start);

How many times do you have to notice the details?

function callback ($buffer) {
file_put_contents (' 111.html ', $buffer);
return $buffer;//No need to display the contents of the page return ';
}
Ob_start ("callback", Php_output_handler_start);

How many times will it take to notice the details?
...


!--? php
function Callback ($buffer) {
file_put_contents (' 111.html ', $buffer);
return $buffer;//No need to display the contents of the page return ';
}
Ob_start ("callback", Php_output_handler_start);
?>



      Require_once (' gongxiang.php ');
      $con = Lianjie ();

      $result = mysql_query ("SELECT * from Tupianwenzi LEFT join detail on tupianwenzi.xiaofenleiindex = Detail.xiaofenleidetail ");

      while ($row = Mysql_fetch_array ($result))
      {






      Echo




    • '. $row [' Xiaofenleiindex ']. '
      '. $row [' Detailindex ']. '

    • ';

      }
      ?>
      Mysql_close ($con);
      ?>

Still can't create a blank

I just tested it again and I need to write for the multi-segment output.

Define (' Cache_file ', ' 111.html '), function callback ($buffer) {  file_put_contents (cache_file, $buffer, File_ APPEND);  return $buffer; No need to display the contents of the page return ';} File_put_contents (Cache_file, '); Ob_start ("Callback", Php_output_handler_start);

Of course you can use global variables instead of constants to specify the target file name

 
  
 
  
  
    ' id ', ' tupianindex ' = ' tupianindex ', ' xiaofenleiindex ' = ' xiaofenleiindex ', ' detailindex ' = ' detailindex '); Echo
  • '. $row [' Xiaofenleiindex ']. '. $row [' Detailindex ']. '
  • ';//}?>

 
  
 
  
  
  • Xiaofenleiindexdetailindex

I just tested it again and I need to write for the multi-segment output.
PHP code?1234567define (' cache_file ', ' 111.html '), function callback ($buffer) {file_put_contents (Cache_file, $buffer, File_append); return $buffer; No need to display the content of the page retur ...


You're too good to be done. How can you do it? How to change the PHP address of this page to HTML

I just tested it again and I need to write for the multi-segment output.
PHP code?1234567define (' cache_file ', ' 111.html '), function callback ($buffer) {file_put_contents (Cache_file, $buffer, File_append); return $buffer; No need to display the content of the page retur ...

How to change the page PHP into HTML
Say
'. $row [' Detailindex ']. '

What are you
File_put_contents (' 111.html ', $buffer);
Before the first execution
$buffer = Preg_replace ('/(href=.+?) \.php/', ' $1.html ', $buffer);

But the rules may not be as simple as you think.

I am a similar problem, so far no solution, ask the great God Ah

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