PHP×Ö·û´®½Ì³Ì_trimº¯Êý
PHP trim() º¯Êý
¶¨ÒåºÍÓ÷¨
trim() º¯Êý´Ó×Ö·û´®µÄÁ½¶Ëɾ³ý¿Õ°××Ö·ûºÍÆäËûÔ¤¶¨Òå×Ö·û¡£
Óï·¨
trim(str,charlist)
²ÎÊý 1 strΪ´ý²Ù×÷µÄ×Ö·û´®£¬²ÎÊý 2 charlist ¿ÉÑ¡£¬Ö¸¶¨ÁËÏëҪȥ³ýµÄÌØÊâ·ûºÅ¡£
Èç¹ûµÚ¶þ¸ö²ÎÊýû¸øÖµ£¬Ô¤Éè»áÈ¥³ýÏÂÁÐÕâЩ×ÖÔª£º
" " (ASCII 32 (0x20)), an ordinary space.
"\t" (ASCII 9 (0x09)), a tab.
"\n" (ASCII 10 (0x0A)), a new line (line feed).
"\r" (ASCII 13 (0x0D)), a carriage return.
"\0" (ASCII 0 (0x00)), the NUL-byte.
"\x0B" (ASCII 11 (0x0B)), a vertical tab.
Èç¹ûҪȥ³ýÆäËü×ÖÔª£¬¿ÉÒÔÔÚµÚ¶þ¸ö²ÎÊýÀïÉ趨¡£
Àý×Ó1
<?php
$str = " ʹÓú¯ÊýtrimÈ¥µô×Ö·û´®Á½¶Ë¿Õ°××Ö·û ";
$str1 = trim($str);
echo "´¦ÀíǰÓÐ".strlen($str)."¸ö×Ö·û";
echo "<br/>"; //www.phpjc.cn
echo "<br/>";
echo "ʹÓÃtrimº¯Êý´¦ÀíºóÓÐ".strlen($str1)."¸ö×Ö·û";
?>
Êä³ö£º
´¦ÀíǰÓÐ39¸ö×Ö·û
ʹÓÃtrimº¯Êý´¦ÀíºóÓÐ34¸ö×Ö·û
Àý×Ó2
<?php
$str = "##ʹÓú¯ÊýtrimÈ¥µô×Ö·û´®Á½¶ËÌØ¶¨×Ö·û####";
$str1 = trim($str,"#"); //Ϊº¯Êýtrim´«ÈëµÚ¶þ¸ö²ÎÊý£¬trim½«É¾³ý×Ö·û´®$strÁ½¶ËµÄ#×Ö·û
echo $str."<br>";
echo $str1;
?>
Êä³ö£º
##ʹÓú¯ÊýtrimÈ¥µô×Ö·û´®Á½¶ËÌØ¶¨×Ö·û####
ʹÓú¯ÊýtrimÈ¥µô×Ö·û´®Á½¶ËÌØ¶¨×Ö·û
Ïà¹ØÎĵµ£º
ÔÀí
Ò»°ã£¬ÓÐ2ÖÖ·½·¨¿ÉÒÔµ¼³ödocÎĵµ£¬Ò»ÖÖÊÇʹÓÃcom£¬²¢ÇÒ×÷ΪphpµÄÒ»¸öÀ©Õ¹¿â°²×°µ½·þÎñÆ÷ÉÏ£¬È»ºó´´½¨Ò»¸öcom£¬µ÷ÓÃËüµÄ·½·¨¡£°²×°¹ýofficeµÄ·þÎñÆ÷¿ÉÒÔµ÷ÓÃÒ»¸ö½Ðword.applicationµÄcom£¬¿ÉÒÔÉú³ÉwordÎĵµ£¬²»¹ýÕâÖÖ·½Ê½ÎÒ²»ÍƼö£¬ÒòΪִÐÐЧÂʱȽϵͣ¨ÎÒ²âÊÔÁËһϣ¬ÔÚÖ´ÐдúÂëµÄʱºò£¬·þÎñÆ÷»áÕ ......
PS:ÎÒ½ñÌìÅäÖà ·þÎñÆ÷µÄʱºò³öÏÖµÄÎÊÌâ¾ÍÊÇÕâ¸ö£¬µ«ÊÇÕÕ×Å·½·¨¶¼×öÁË£¬Ñ¾µÄ¡£¡£»¹ÊÇûÓ㬼«¶ÈÓôÃÆËÀ¡£¡£°¥¡£¡£¡£ÎÒÒ²²»ÖªµÀʲôÔÒòÄØ¡£¡£¿ÉÄܵÄÔÒò¶¼ÕÒ¹ýÁË¡£¡£ÓôÃÆ°¡`~
apache2+mysql+php5+phpmyadminÅäÖÃÎÊÌ⣺ÎÞ·¨¼ÓÈëmysqlÀ©Õ¹£¬Çë¼ì²éphpÅäÖÃ...
°²×°Íêapache2+mysql+php5ºó£¬°²×°phpmyadmin²¢ÅäÖúÃÒÔºó£¬ÔÚä¯À ......
ÖÐÎÄ×Ö·û½ØÈ¡ÊÇÒ»¸öÊ®·ÖÓÐÓõŦÄÜ£¬ÔÚºÜ¶àµØ·½¶¼»áÓõ½£¬±ÈÈçÌáÈ¡¶¨³¤±êÌ⣬³éÈ¡±êÇ©µÈ
ÓÉÓÚ¸÷ÖÖ×Ö·û¼¯µÄ´æ´¢·½Ê½µÄ²»Ò»Ñù£¬´æÔÚË«×Ö½Ú£¨GBK£©¶à×Ö½Ú£¨Unicode£©µÄ´æ´¢·½Ê½£¬Õâ¾Íµ¼ÖÂÁËͳһ´¦ÀíµÄÀ§ÄÑ¡£
¹ú¼Ê±ê×¼UTF8×Ö·û±àÂëÖУ¬´æ´¢ÖÐÎÄ×Ö·ûÒª3¸ö×Ö½Ú£¬¼´°ÑphpÎļþ´æ´¢ÎªUTF8±àÂë¸ñʽ¿ÉÒԵõ½
strlen(& ......
¡¡¡¡¸÷´óÍøÂç±à³ÌÓïÑÔµÄ10Äê·ÜÕ½£¬¸÷ÓÐËù³¤¡¢¸÷ÁìǧÇï¡£½ñÈÕ¶ÔÓÚÎÒÃǵÄÍøÕ¾±à³ÌÓïÑÔ:ASP¡¢JSP¡¢PHP¡¢ASP.NET½øÐÐʵ¼ÊÓ¦ÓÃͳ¼Æ:
¡¡¡¡ASP:50%
¡¡¡¡JSP:10%
¡¡¡¡PHP:20%
¡¡¡¡ASP.NET:20%
¡¡¡¡¸ù¾ÝÒÔÉÏͳ¼ÆÀ´×öÒ»ÏÂÌÖÂÛ¡£ASP¼¼ÊõÈç½ñÌì¿ÉÒÔ˵ÒѳÉΪ¹ýÈ¥£¬µ«ÈÔÕ¼Êг¡µÄ50%£¬ÒòΪµ±Ê±ASP¼¼ÊõµÄÐËÆð£¬¶Ô´ó²¿·Ö±à³Ì ......
class_exists — Åж¨Ò»¸öÀàÊÇ·ñÒѾ±»¶¨Òå
get_class_methods — »ñȡij¸öÀàÖÐËùÓз½·¨µÄÃû³Æ
get_class_vars — »ñȡһ¸öÀàÖÐËùÓеÄÌØÐÔ
get_class — ·µ»ØÒ»¸ö·½·¨ËùÔÚµÄÀàÃû
get_declared_classes — ÏÔʾÒѶ¨ÒåµÄÀàµÄÐÅÏ¢
get_declared_interfaces — ÏÔʾÒѶ¨ÒåµÄ½Ó¿ÚµÄÐÅÏ¢
get ......