1

我使用 httpful 发送 http 请求并获取响应以显示在 request.php

include('httpful.phar');

$response = \Httpful\Request::get('http://domain/response.php')->send();

echo '<textarea rows="20" cols="100">';
echo $response;
echo '</textarea>';

在 response.php 中,我使用 header 将请求重定向到另一个页面,但我无法获得预期的响应。

header("HTTP/1.1 301 Moved Permanently");
header("Location:http://otherdomain/other_response.php");

echo 'internal response page'

我也试过

header("HTTP/1.1 302 Found");

但它仍然只得到响应“内部响应页面”

将请求重定向/转发到 other_response.php 的正确方法是什么?

4

1 回答 1

0

据我所知,您只能使用 header(); 一次。它必须先输出。从您显示的代码中,除此之外我没有看到任何错误。

于 2013-10-18T09:28:20.220 回答