一起源码网

标题: php:输出缓冲区处理函数用法总结 [打印本页]

作者: 云文章    时间: 2020-3-2 07:30
标题: php:输出缓冲区处理函数用法总结
输出缓冲区处理函数的作用有点类似C的堆栈,临时放入一个存储空间中,对内容进行处理。

输出缓冲区函数有:

实例如下:

<?php  
 define('APP_ROOT', dirname(FILE));
 $file = '/templates/html/error_config.html';
 ob_start(); 
 include(APP_ROOT.$file);
 ob_end_flush();
   //$contents = ob_get_contents();  这样可以将输出保存,可以作进一步处理
  //ob_end_clean();
   //echo $contents;
 ?>
<?php echo"<?xml version="1.0" encoding="utf-8">"; ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD  XHTML 1.0  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <meta http-equiv="Content-Script-Type" content="text/javascript" />
     <meta http-equiv="Content-Style-Type" content="text/css" />
     <title>Error</title>
 </head>
 <body onload="doRedirect()">
 <h1>Error</h1>
 <p style="position:absolute;top:150px;text-align:center;width:95%;">
     <p style="margin:12pt;"><strong>config.php</strong> does not exist or is not readable by the webserver in the directory.</p>
     <p style="margin:12pt;"><?php echo CommonFunctions::$PSI_VERSION_STRING ?></p>
 </p>
 </body>
 </html>

输出结果如下:

config.php does not exist or is not readable by the webserver in the phpsysinfo directory.


作者: wmm2599    时间: 2022-9-1 14:45
音乐平台源码




欢迎光临 一起源码网 (https://www.171739.xyz/) Powered by Discuz! X3.3