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

PHP½ØÈ¡¹Ì¶¨³¤¶È×Ö·û´®º¯Êý

<?php   
  
function toFixLen($str,$len){ //¹Ì¶¨³¤¶È×Ö·û´®µÄ½ØÈ¡   
  
    if($len>=strlen($str)||!$len) return $str;   
  
    $len-=3;   
  
    $tempstr1 = substr($str,0,$len); //½ØÈ¡×Ö·û´®   
  
    $tempstr2 = preg_replace('/([\x81-\xff]+)$/ms','',$tempstr1,1); //È¥µô½áβµÄÁ¬Ðøºº×Ö×Ö·û   
  
    if(!is_int((strlen($tempstr1)-strlen($tempstr2))/2)){ //È¥µôµÄ×Ö·ûΪÆæÊý?   
  
        $tempstr1 = substr($str,0,$len-1);   
  
    }   
  
    return $tempstr1."…";   
  
}   
  
?>


Ïà¹ØÎĵµ£º

²ÉÓÃPHPʵÏÖ¡±·þÎñÆ÷ÍÆ¡±¼¼ÊõµÄÁÄÌìÊÒ

    * ×÷Õß: laruence(http://www.laruence.com)
    * ±¾ÎĵØÖ·: http://www.laruence.com/2008/04/16/118.html
    * תÔØÇë×¢Ã÷³ö´¦
´«Í³µÄB/S½á¹¹µÄÓ¦ÓóÌÐò£¬¶¼ÊDzÉÓÔ¿Í»§¶ËÀ­”½áÊøÀ´ÊµÏÖ¿Í»§¶ËºÍ·þÎñÆ÷¶ËµÄÊý¾Ý½»»»¡£
±¾ÎĽ«Í¨¹ý½áºÏTicks(¿ÉÒԲο´ÎÒ ......

PHP×ÔѧÈÕ¼Ç


--------------01-05--------------------
*
*              Îļþ²Ù×÷
*
---------------------------------------
¶ÁÈ¡Õû¸öÎļþ: readfile(), fpassthru(), file()
¶ÁÈ¡Ò»¸ö×Ö·û: fgetc()
¶ÁÈ¡ÈÎÒⳤ¶È: fread()
²é¿´ÎļþÊÇ·ñ´æÔÚ: file_exis ......

¡¾PHPϵÁн̡̳¿(5)——PHPµÄ³£Á¿

¡¾PHPϵÁн̡̳¿(4)½²ÊöÁËPHPµÄ±äÁ¿£ºhttp://blog.csdn.net/rocket5725/archive/2010/01/08/5159704.aspx
±¾½ÚÖ÷Òª½éÉÜPHPÖеij£Á¿£¬Ö÷Òª°üÀ¨ÆäÓï·¨ºÍÔ¤¶¨Òå³£Á¿µÄ½éÉÜ¡£
³£Á¿ÊÇÒ»¸ö¼òµ¥ÖµµÄ±êʶ·û£¨Ãû×Ö£©¡£ÈçͬÆäÃû³ÆËù°µÊ¾µÄ£¬Ôڽű¾Ö´ÐÐÆÚ¼ä¸ÃÖµ²»Äܸı䣨³ýÁËËùνµÄħÊõ³£Á¿£¬ËüÃÇÆäʵ²»Êdz£Á¿£©¡£³£Á¿Ä¬ÈÏΪ´óСдà ......

PHPº¯Êý__autoload()ºÍspl_autoload_register()

__autoload($classname){
}
µ±PHPÕÒ²»µ½ÀàÎļþ»áµ÷ÓÃÕâ¸ö·½·¨£¬µ±×¢²áÁË×Ô¼ºµÄº¯Êý»ò·½·¨Ê±£¬PHP²»»áµ÷ÓÃ__autoload()º¯Êý£¬¶ø»áµ÷ÓÃ×Ô¶¨ÒåµÄº¯Êý
spl_autoload_register('func_name');
spl_autoload_register(array('class_name','method_name')); ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ