how to display the binary form of the file with php?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Every file can be displayed in the binary form no matter which encoding the file is.(utf-8 gbk  iso-8859-1  latin-1)
     
    `xxd  filename` can do the trick.

Now i want to do with php,here is my try.


<?php     $target="test.txt";     $file_handle = fopen($target, "rb");     while (!feof($file_handle)) {        $byte = fread($file_handle,1);        echo $byte;     }     fclose($file_handle ); ?> 
It is unlucky that all the character is not displayed on binary form,how to  fix `echo $byte`  ?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux