1
我想将用户重定向到我的网站的移动版本。将php变量发布到使用javascript的移动网站 - 空白变量
重定向工作正常,但PHP变量没有通过。
我使用了以下内容:
<script>
if ($(window).width() < 480 || $(window).height() < 480) {
var searchproducts = "<?php $_GET['search']?>";
var category = "<?php $_GET['cat']?>";
var page="http://m.website.com/search.php?search="+searchproducts+"&cat="+category;
document.location.href=page;
}
</script>
我也曾尝试:
<script>
if ($(window).width() < 480 || $(window).height() < 480) {
window.location.replace("http://m.website.com/search.php?search=<?php $_GET['search']?>&cat=<?php $_GET['cat']?>");
}
</script>
谁能帮助?
感谢
谢谢,工作。 – user3312792
@ user3312792,另外,使用'isset'构造来避免'未定义的索引'通知。 –