以下是我的代码片段,我将屏幕宽度分配给变量$width.但是当我将它转换为整数并回显它时,0会返回.
$width = '<script> document.write(window.screen.width); </script>';
//if i echo $width it shows 1366 which is width of my screen
$height = '<script> document.write(window.screen.height); </script>';
echo "The height is = $height"."<br>The width is = ".$width;
$a = (int)($width);
echo $a;
Run Code Online (Sandbox Code Playgroud)
我要求指导这种转换完美.
| 归档时间: |
|
| 查看次数: |
989 次 |
| 最近记录: |