search
Homephp教程php手册PHP4的新函数介绍-输出信息控制函数,以前别人转发的

PHP4的新函数介绍-输出信息控制函数,以前别人转发的

Jun 13, 2016 am 10:28 AM
introduceinformationfunctioncontrolnew functionofForwardoutput

PHP4 的新函数介绍 - 输出信息控制函数 魔族精灵 这些函数可以让你控制你的脚本输出的内容.可以用于许多不同的情况,特别是在你的脚本已经输出信息后需要发送文件头新的情况. 输出控制函数不对使用 header() 或 setcookie() 发送的文件头信息产生影响,只对那些类似于 echo() 和 PHP 代码的数据块有作用. 例 1. 控制输出 在上面的例子中,使用 echo() 的输出内容将会保存在输出缓冲区中,直到调用了 ob_end_flush(). 这样做有意义的地方是,调用 setcookie() 的内容被成功的存储在 cookie 里面而不会引起错误. (正常情况下,你不可以在有数据已经发送后再发送文件头信息到用户浏览器.) 相关函数 header() and setcookie(). 韩数列表 flush — 刷新输出缓冲区 保存在输出缓冲区的内容会被发送到浏览器 ob_start — 打开输出缓冲区 这样所有的输出信息不在直接发送到浏览器,而是保存在输出缓冲区里面 ob_get_contents — 返回输出缓冲区的内容 如果你想以后处理输出的内容,可以调用这个函数保留一个备份 ob_get_length — 返回输出缓冲区的内容长度 ob_end_flush — 结束(发送)输出缓冲区的内容,关闭输出缓冲区 ob_end_clean — 删除(放弃)输出缓冲区的内容,关闭输出缓冲区 如果你的程序发现输出内容有问题,可以放弃所有输出内容,可以防止泄漏某些秘密信息 ob_implicit_flush — 打开或关闭直接刷新 打开后,每个脚本输出都直接发送到浏览器,不再需要调用 flush(),

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools