Making all PHP file output pass through a “filter file” before being displayed

后端 未结 5 1791
傲寒
傲寒 2020-12-17 02:43

Is there any way for all my PHP and/or HTML file output to be \"filtered\" before being displayed in the browser? I figured that I could pass it through a global function b

5条回答
  •  醉酒成梦
    2020-12-17 03:24

    You can use PHP's output buffering functions to do that

    You can provide a callback method that is called when the buffer is flushed, like:

    
    
    
        

    It's like comparing apples to oranges.

    In that case output is buffered instead of sent from the script and just before the flush your callback method is called.

提交回复
热议问题