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'構造來避免'未定義的索引'通知。 –