Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
重定向和PHP变量问题_Php_Html_Variables_Redirect_Meta Tags - Fatal编程技术网

重定向和PHP变量问题

重定向和PHP变量问题,php,html,variables,redirect,meta-tags,Php,Html,Variables,Redirect,Meta Tags,因此,我有以下代码: echo "<meta http-equiv=\"refresh\" content=\"1;url=/$file\" />"; 实际上,我希望它被重定向到http://[redacted].co.uk/output/ytusgh 有人知道我能做些什么来实现重定向吗?基本上,重定向是由浏览器完成的,浏览器可以处理URL 因此,您必须确保您在标记中使用了一个URL;而不是文件的路径 我不知道如何构造$file变量;但您必须更改代码的这一部分,以确保$file不指

因此,我有以下代码:

echo "<meta http-equiv=\"refresh\" content=\"1;url=/$file\" />";
实际上,我希望它被重定向到http://[redacted].co.uk/output/ytusgh


有人知道我能做些什么来实现重定向吗?

基本上,重定向是由浏览器完成的,浏览器可以处理URL

因此,您必须确保您在
标记中使用了一个URL;而不是文件的路径


我不知道如何构造
$file
变量;但您必须更改代码的这一部分,以确保
$file
不指向文件,而是包含您要重定向到的URL。

似乎您正在传递本地路径,而您需要传递绝对路径

试一试

$file=preg_replace('path/to/local/folder',''.$file);
$file=$yourdomain$文件
回声“;

var\u dump($file)?string(47)“/home/[redacted]/public\u html/[redacted]/output/ytusgh”的输出是什么
http://home/[redacted]/public_html/[redacted]/output/ytusgh
$file = preg_replace('path/to/local/folder', '', $file);
$file = $yourdomain . $file;
echo "<meta http-equiv=\"refresh\" content=\"1;url=/$file\" />";