Home  >  Article  >  Backend Development  >  tinyshop - 在PHP中使用ob_get_length的作用

tinyshop - 在PHP中使用ob_get_length的作用

WBOY
WBOYOriginal
2016-06-06 20:44:151047browse

刚刚在看tinyshop的源码,在代码中经常能看到下面的代码,使用了内容缓存机制,请问这个到底做什么用的?

if(ob_get_length()>0)ob_end_clean();

还有就是为什么我在里面使用echo和var_dump这些,页面都不能输出呢?

回复内容:

刚刚在看tinyshop的源码,在代码中经常能看到下面的代码,使用了内容缓存机制,请问这个到底做什么用的?

if(ob_get_length()>0)ob_end_clean();

还有就是为什么我在里面使用echo和var_dump这些,页面都不能输出呢?

缓冲被hold住了。echo后用ob_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