Home  >  Article  >  php教程  >  解析PHP缓存函数的使用说明

解析PHP缓存函数的使用说明

WBOY
WBOYOriginal
2016-06-13 11:53:01895browse

flush():刷新输出程序缓存
for($i = 0; $i

    echo str_repeat("\n", 5000);
    echo $i;
    sleep(1);
    flush();
}

ob_start(回调函数,限定长度,随时输出缓存='true'):开启,前提:output_buffer = on
ob_clear():刷新
ob_end_clear():关闭,并刷新
ob_flush():输出
ob_end_flush():关闭,并输出

ob_get_contents:返回缓存
ob_get_clean():返回缓存,并刷新
ob_get_flush():返回缓存,并关闭
ob_get_length():返回缓存内容长度
ob_get_level():返回缓存嵌套级别
ob_get_status(返回所有的=false):返回缓存区状态

ob_gzhandler():压缩输出缓存,用作回调函数:ob_start('ob_gzhandler')
ob_implicit_flush(输出刷新=true):参数为true时,每次缓存输出都会自动刷新缓存
ob_list_handlers():列出所有正在使用缓存的函数。


output_add_rewrite_var(变量,值):添加URL重写器的值此函数给URL重写机制添加名/值对。 这种名值对将被添加到URL(以GET参数的形式)和表单(以input隐藏域的形式),当透明URL

重写用 session.use_trans_sid开启时同样可以添加到session ID。绝对URL(http://example.com/)不被重写,函数行为由url_rewriter.tags php.ini参数控制

output_add_rewrite_var('var', 'value');
echo '可以重写';   //重写后:link
echo 'link2';//绝对地址不被重写
echo '

'; //重写后:


output_reset_rewrite_vars():重置URL重写器的值,成功返回true

output_add_rewrite_var('var', 'value');
echo '不被重写'; 
output_reset_rewrite_vars();//重置
echo '不被重写';//重置了,地址不被重写
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