Checking if your code is running on 64-bit PHP

1023 ワード

Check the PHP_INT_SIZE constant. It'll vary based on the size of the register (i.e. 32-bit vs 64-bit).
 
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>

 it is contained in the variable, you could explode that and derive it from that
 
or
<?php
switch(PHP_INT_SIZE) {
    case 4:
        echo '32-bit version of PHP';
        break;
    case 8:
        echo '64-bit version of PHP';
        break;
    default:
        echo 'PHP_INT_SIZE is ' . PHP_INT_SIZE;
        break;
}

 
This code snippet will at-least tell you if a 32/64 bit version of PHP is running.
 
ソース:http://stackoverflow.com/questions/6303241/find-windows-32-or-64-bit-using-php