通过将phpinfo()打印到文件实现
<?php echo str_pad(‘‘, 1024);//使缓冲区溢出 ob_start();//打开缓冲区 phpinfo(); $string = ob_get_contents();//获取缓冲区内容 $myfile = fopen("phpinfo.html", "w") or die("Unable to open file!"); fwrite($myfile, $string); fclose($myfile); ob_end_clean();//清空并关闭缓冲区 ?>
原文:http://www.cnblogs.com/manhua/p/4571688.html