phpÈ¥µô×Ö·û´®µÄ×îºóÒ»¸ö×Ö·û substr()µÄÓ÷¨
Ô×Ö·û´®1,2,3,4,5,6,
È¥µô×îºóÒ»¸ö×Ö·û","£¬×îÖÕ½á¹ûΪ1,2,3,4,5,6
´úÂëÈçÏ£º
$str = "1,2,3,4,5,6,";
$newstr = substr($str,0,strlen($str)-1);
echo $newstr;
ϵͳ×Ô´øµÄº¯ÊýÒ²¿ÉʵÏÖÕâÑùµÄЧ¹û£¬Á½ÖÖ·½·¨£º
1£© substr($str, 0, -1)
2£©rtrim($str, ",")
substr
È¡²¿·Ý×Ö·û´®¡£
Óï·¨: string substr(string string, int start, int [length]);
·µ»ØÖµ: ×Ö·û´®
º¯ÊýÖÖÀà: ×ÊÁÏ´¦Àí
ÄÚÈÝ˵Ã÷
±¾º¯Êý½«×Ö·û´® string µÄµÚ start λÆðµÄ×Ö·û´®È¡³ö length ¸ö×Ö·û¡£Èô start Ϊ¸ºÊý£¬Ôò´Ó×Ö·û´®Î²¶ËËãÆð¡£Èô¿ÉÊ¡ÂԵIJÎÊý length ´æÔÚ£¬µ«Îª¸ºÊý£¬Ôò±íʾȡµ½µ¹ÊýµÚ length ¸ö×Ö·û¡£
ʹÓ÷¶Àý
echo substr("abcdef", 1, 3); // ·µ»Ø "bcd"
echo substr("abcdef", -2); // ·µ»Ø "ef"
echo substr("abcdef", -3, 1); // ·µ»Ø "d"
echo substr("abcdef", 1, -1); // ·µ»Ø "bcde"
PHP rtrim() º¯Êý
¶¨ÒåºÍÓ÷¨
rtrim() º¯Êý´Ó×Ö·û´®µÄÄ©¶Ë¿ªÊ¼É¾³ý¿Õ°××Ö·û»òÆäËûÔ¤¶¨Òå×Ö·û¡£Í¬chop()º¯Êý¡£
Óï·¨
rtrim(string,charlist)
²ÎÊý ÃèÊö
string ±ØÐè¡£¹æ¶¨Òª×ª»»µÄ×Ö·û´®¡£
charlist
¿ÉÑ¡¡£¹æ¶¨´Ó×Ö·û´®ÖÐɾ³ýÄÄЩ×Ö·û¡£
Èç¹ûδÉèÖøòÎÊý£¬ÔòÈ«²¿É¾³ýÒÔÏÂ×Ö·û£º
* "\0" - ASCII 0, NULL
* "\t" - ASCII 9, ÖƱí·û
* "\n" - ASCII 10, ÐÂÐÐ
* "\x0B" - ASCII 11, ´¹Ö±ÖƱí·û
* "\r" - ASCII 13, »Ø³µ
* " " - ASCII 32, ¿Õ¸ñ
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ