我需要重定向网址
https://vivekp.co/server/apiurl/qwertyuiopl
但它重定向到
https://vivekp.co/server/apiurl/".$youtube_id
怎么解决这个问题?
<?php
if (isset($_GET['urlid'])) {
$url = $_GET["urlid"];
//$url="https://youtube.com/watch?v=fbjfnjnfkjs";
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
$youtube_id = $match[1];
$nr="https://vivekp.co/server/apiurl/".$youtube_id;
header('location:$nr');
}else{
echo "Error";
}
?>发布于 2017-11-24 04:53:39
把你的头设置成,
header('location:'.$nr);发布于 2017-11-24 05:24:31
您应该从''中取出变量或将其更改为""。
header("location:$nr");或
header('location:'.$nr);https://stackoverflow.com/questions/47466536
复制相似问题