【发布时间】:2017-06-21 20:53:39
【问题描述】:
您好,我正在尝试读取一个文件,其中包含我想重定向的 url 我正在使用这个
$file = 'test.txt';
$myfile = fopen($file, "r") or die("Unable to open file!");
$link = fread($myfile,filesize($link));
fclose($myfile);
header("Location: $link");
浏览器显示错误“页面未正确重定向”
文件 test.txt 包含
http://www.google.es
【问题讨论】:
-
愚蠢但必要的问题。您是否尝试过 echo $link 并检查是否没有隐藏字符?
-
如果您想一次读取整个文件,为什么不直接调用
file_get_contents()?