$screenx = "<script>document.write(screen.width);</script>";
   echo $screenx;
   现在我浏览器的宽度为1024   输出结果为1024。  一切正常,OK。   $aa=$screenx +100;
   echo $aa;
   现在+100之后, 居然aa 的值=100 什么原因? 难道$screenx =0 ?
求老手回答

解决方案 »

  1.   

    JS获取的宽度你在PHP咋用,用也得AJAX传值啊
      

  2.   

    而且  if ($screenx ==1024){
         echo '正常';
         }else{
         echo '不正常';
         }结果为: 不正常。
      

  3.   


    为什么我这样$screenx=$aa
    echo $aa;$aa 是有值的,为什么$aa还能赋值呢?
      

  4.   

    $screenx = "<script>document.write(screen.width);</script>"; 这是一个字符串
    如果把它当做数,那么就是 0
    于是 $aa=$screenx +100; 后
    $aa 等于 100
      

  5.   

    你这$screenx变量在php里面就是一个字符串
      

  6.   

     $screenx  不是string类型么
    $aa=$screenx +100;   //与整形计算时,字符串要转化才整形,0+100 = 100