<?php /** * ob_start 缓冲 */ function callback($buffer) { return str_replace('apple','orange',$buffer); } ob_start('callback');//将整个页面放到callback中的$buffer echo "this is an apple!"; ob_end_flush(); echo "this is another apple!";