PHP:使用 URL 参数打印 '<meta http-equiv="refresh" content="0;url='
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4650406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP: print '<meta http-equiv="refresh" content="0;url=' with URL parameters
提问by sehummel
How do I create this string with URL parameters? What I want is something like:
如何使用 URL 参数创建此字符串?我想要的是这样的:
print '<meta http-equiv="refresh" content="0;url=http://domain.com?a=1&b=2">';
But that doesn't pass my second parameter correctly. I get a ")" instead of a b. What am I doing wrong?
但这并没有正确传递我的第二个参数。我得到一个“)”而不是一个 b。我究竟做错了什么?
I've tried &
instead of the ampersand, but that doesn't work either,
我试过&
代替与号,但这也不起作用,
回答by thegryphon
echo "<meta http-equiv='refresh' content='0;url=http://domain.com?a=1&b=2'>";
or even
甚至
header ("Location: url=http://domain.com?a=1&b=2");
since you are using 0 as delay
因为您使用 0 作为延迟
回答by Your Common Sense
If you're already using 0 delay for the <meta>
refresh, why don't you just use a HTTP Location
redirect?
如果您已经使用 0 延迟进行<meta>
刷新,为什么不只使用 HTTPLocation
重定向?
<?php
header('Location: http://domain.com?a=1&b=1');
and if it's in the middle of a page you have to rewrite your program to make it SENSIBLE
如果它在页面的中间,你必须重写你的程序以使其合理
回答by PeeHaa
Why shouldn't you code work? Cause it does work...
为什么你不应该编码工作?因为它确实有效...
If I run your code I go to:
如果我运行你的代码,我会去:
domain.com?a=1&b=2
回答by Aziz
print "<meta http-equiv='refresh' content='0;url=http://domain.com?a=1&b=2'>";
there are differences between '
and "
'
和之间有区别"