Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
php得到输出缓冲区的内容,即拦截echo输出的内容 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


使用ob_start()开始拦截echo输出的内容

ob_get_contents()函数得到缓冲区内容,ob_end_clean();停止拦截echo语句。


例子:

<?php
    
    ob_start();
    echo "a";
    $get = ob_get_contents();
    ob_end_clean();
    
    echo "Get : ".$get;
?>

这样会把echo "a";输出的内容拦截下来并保存到$get,输出的结果就是:

Get : a




返回首页


Copyright (C) 2018-2024 huidong