【发布时间】:2015-11-16 03:16:20
【问题描述】:
我正在尝试将 javascript 变量插入 php mysql,但它没有插入。它插入为<javascript>document.write(window.outerWidth); </javascript> x <javascript>document.write(window.outerHeight); </javascript>。但结果是 1366 x 728
我该怎么办?
<?php
$width = " <script>document.write(window.outerWidth); </script>";
$height = " <script>document.write(window.outerHeight); </script>";
$xex = " x ";
$resulteee = "$width $xex $height";
echo $resulteee;
?>
【问题讨论】:
-
JavaScript 在客户端运行,之后它解析文件 HTML。因此没有显示 no JavaScript;只是一些包含一些“
-
你需要使用
XMLHttpRequest即ajax。 -
好的先生,我现在应该怎么做才能将结果 1366 x 728 插入到我的 php mysql 数据库中。实际上我正在使用此代码获取访问者浏览器大小。
-
谢谢user2864740先生,但不幸的是我是php新手,我不明白你给我的链接中的代码先生。
标签: javascript php jquery html mysql