Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下代码不起作用。
$newPageURL1 = '#post2'; $newPageURL2 = 'http://localhost/feed/all'.$newPageURL1; header('Location: $newPageURL2');
它仅重定向到 /feed/all 而不重定向到 div 位置。
我需要将代码重定向到 /feed/all#post2
将单引号更改为双引号,以便 php 评估您的变量
header("Location: $newPageURL2");