当前位置:编程学习 > php >>

php 刷新输出缓冲代码

<?php教程

function throw_error($message) {
$error_page = "/err/error.php";

$error_url = $error_page;
$error_url .= "?REDIRECT_ERROR_NOTES=$message";
$error_url .= "&REDIRECT_URL=" . $GLOBALS["PHP_SELF"];
$error_url .= "&REDIRECT_REQUEST_METHOD=$REQUEST_METHOD";
$error_url .= "&REDIRECT_STATUS=501";
Header("Status: 501");
Header("Location: $error_url");
exit;
}

ob_start();
// 使用输出缓冲以便在这页中的任何地方输出错误

if(!condition) {
throw_error("the condition failed");
}

ob_end_flush();
// 页面处理完毕,刷新输出缓冲

补充:Php教程,Php常用代码 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,