php缓冲区探析
来源:互联网 发布:淘宝达人佣金给多少 编辑:程序博客网 时间:2024/06/08 00:43
缓冲区用到的3个函数:
1.ob_start();
2.$buffer = ob_get_contents();
3.ob_end_clean();
用法示例:CI框架 system/core/Exceptions.php Ci_Exceptions 的show_error方法
/**
* General Error Page
*
* Takes an error message as input (either as a string or an array)
* and displays it using the specified template.
*
* @param string $heading Page heading
* @param string|string[] $message Error message
* @param string $template Template name
* @param int $status_code (default: 500)
*
* @return string Error page output
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
$templates_path = config_item('error_views_path');
if (empty($templates_path))
{
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
}
if (is_cli())
{
$message = "\t".(is_array($message) ? implode("\n\t", $message) : $message);
$template = 'cli'.DIRECTORY_SEPARATOR.$template;
}
else
{
set_status_header($status_code);
$message = '<p>'.(is_array($message) ? implode('</p><p>', $message) : $message).'</p>';
$template = 'html'.DIRECTORY_SEPARATOR.$template;
}
if (ob_get_level() > $this->ob_level + 1)
{
ob_end_flush();
}
ob_start();
include($templates_path.$template.'.php');
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
未完待续。。。。。。。
- php缓冲区探析
- php 缓冲区
- php缓冲区
- php--缓冲区
- joomla源代码探析(四) defines.php
- joomla源代码探析(五) framework.php
- PHP的输出缓冲区.
- 关于PHP 缓冲区
- PHP的输出缓冲区
- PHP的输出缓冲区
- PHP的缓冲区
- PHP的输出缓冲区
- php的缓冲区问题
- php输出缓冲区
- PHP的输出缓冲区
- PHP输出缓冲区
- php缓冲区详解
- php缓冲区详解
- 前端开发学习流程
- 深入了解Android蓝牙Bluetooth——《进阶篇》
- Shadowsocks利用 Socat 实现单端口 中继(中转/端口转发)加速
- SF6项目——Login
- Lucene 深入学习(1)全文检索
- php缓冲区探析
- 关于scanf的问题
- 使用Servlet上传多张图片——访问提示
- Windows / Ubuntu操作系统下Pixhawk原生固件PX4的编译方法
- 语音识别原理
- 深入了解Android蓝牙Bluetooth——《基础篇》
- HttpServletRequest即很多代码中的request对象
- turtle库 螺线
- Spring_pojo