我包含一个更改 URL 的 PHP 脚本。
// index.php
ob_start();
include "script.php";
// This script redirects using header("Location:");
$out = ob_get_clean();
// I use the $out data for calculations
echo $out;
有没有一种简单的方法来对抗或撤消这种不需要的重定向?怎么样:
header("Location: index.php"); // redirect back to self
但这会导致无休止的重定向循环......有什么想法吗?
或者有没有办法从 $out 缓冲区中去掉 header() 调用,防止它到达客户端?