以下是我将屏幕宽度分配给 variable 的一段代码$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;
我正在寻求指导以使这种转换变得完美。