Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php ×Ö·û´®¡¢Îļþת»¯³É¶þ½øÖÆÁ÷Îļþ

$file1 = 'F:/46.gif';
$file2 = 'F:/test.txt';
$file3 = 'F:/47.gif';
$size = filesize($file1);
echo 'Îļþ´óСΪ£º'.$size;
echo "\n<br>ת»¯Îª¶þ½øÖÆ ...";
$content = file_get_contents($file1);
$content = bstr2bin($content);
$fp = fopen($file2, 'w');
fwrite($fp, $content);
fclose($fp);
$size2 = filesize($file2);
echo 'ת»¯³É¶þ½øÖƺóÎļþ´óСΪ£º'.$size2;
$content = bin2bstr($content);
$fp = fopen($file3, 'w');
fwrite($fp, $content);
fclose($fp);
function bin2bstr($input)
// Convert a binary expression (e.g., "100111") into a binary-string
{
  if (!is_string($input)) return null; // Sanity check
  // Pack into a string
  $input = str_split($input, 4);
  $str = '';
  foreach ($input as $v)
  {
   $str .= base_convert($v, 2, 16);
  }
 
  $str =  pack('H*', $str);
 
  return $str;
}
function bstr2bin($input)
// Binary representation of a binary-string
{
  if (!is_string($input)) return null; // Sanity check
  // Unpack as a hexadecimal string
  $value = unpack('H*', $input);
 
  // Output binary representation
  $value = str_split($value[1], 1);
  $bin = '';
  foreach ($value as $v)
  {
   $b = str_pad(base_convert($v, 16, 2), 4, '0', STR_PAD_LEFT);
   
   $bin .= $b;
  }
 
  return $bin;
}


Ïà¹ØÎĵµ£º

php ¼¼ÊõÄÚĻѧϰ2

1.php Êý¾ÝÀàÐÍ£º¸¡µãÐÍ,×Ö·û´®,ÕûÐÎ,Âß¼­ÐÍ
2.$a="test"; print($a); ÔÚphp.ini ÖÐÉèÖÃerror_reporting=E_ALL ¾¯¸æ×´Ì¬Ê±£¬»áÓÐÌáʾ¡£´ËÓÃÓÚ²âÊÔ䶨ÒåµÄ±äÁ¿¡£¿ÉÒÔʹÓÃisset()¼ì²â±äÁ¿ÊÇ·ñ´æÔÚ,unsetÇå³ý±äÁ¿()£¬³£Á¿¶¨Òådefine("a","test");¶¨ÒåµÄ³£Á¿¾ßÓÐÈ«¾Ö×÷Óá£define ÎÞ·¨¶¨Òå¶ÔÏóµÄÊý¾Ý½á¹¹£¬²»¹ý¿ÉÒÔÏÈ´æ´¢±äÁ¿ ......

PHPÖеÄÅú´¦Àí£¨Ò»£©

ת×Ô£º http://www.phpsoho.com/article/php/200809/09-239.html
Èç¹û Web Ó¦ÓóÌÐòÖеÄÒ»¸öÌØÐÔÐèÒª³¬¹ý 1 Ãë»ò 2 Ãë²ÅÄÜÍê³É£¬ÄÇôӦ¸ÃÔõô°ì£¿ÐèҪijÖÖÀëÏß´¦Àí½â¾ö·½°¸¡£Ñ§Ï°¼¸ÖÖ¶Ô PHP Ó¦ÓóÌÐòÖг¤Ê±¼äÔËÐеÄ×÷Òµ½øÐÐÀëÏß·þÎñµÄ·½·¨¡£
´óÐ͵ÄÁ¬ËøµêÓÐÒ»¸ö´óÎÊÌ⡣ÿÌ죬ÔÚÿ¼ÒÉ̵ê»á·¢ÉúÊýǧ´Î½»Òס ......

PHP $_SERVER[¡¯PHP_SELF¡¯]

REQUEST_URI ·µ»ØµÄÊǰüÀ¨ºóÃæÊý¾Ý´®µÄµØÖ·£¬Èç index.php?str=1234 PHP_SELF ÊÇ index.php
--------------------------------------------------------------------------------
$_SERVER[’PHP_SELF’]ÔÚ¿ª·¢µÄʱºò³£»áÓõ½£¬Ò»°ãÓÃÀ´ÒýÓõ±Ç°ÍøÒ³µØÖ·£¬²¢ÇÒËüÊÇϵͳ×Ô¶¯Éú³ÉµÄÈ«¾Ö±äÁ¿£¬Ò²»áÓÐʲôÎÊÌâô?È ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ