×ðÁú¿­Ê±

laravelÔõô½ØÈ¡×Ö·û

laravelÊÇÒ»¸öÊ¢ÐеÄphp¿ò¼Ü £¬ÌṩÁË´ó×ڵĹ¦Ð§ºÍ¹¤¾ßÀ´¿ìËÙ¹¹½¨webÓ¦ÓóÌÐò¡£ÔÚÏÖʵ¿ª·¢ÖÐ £¬ÎÒÃǾ­³£ÐèÒª¶Ô×Ö·û´®¾ÙÐд¦Öóͷ£ £¬ÀýÈç½ØÈ¡×Ö·û¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlaravelÖнØÈ¡×Ö·û¡£

Ò»¡¢Ê¹ÓÃPHPÄÚÖú¯Êý½ØÈ¡×Ö·û

ÔÚLaravelÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃPHPÄÚÖú¯ÊýÀ´½ØÈ¡×Ö·û¡£PHPÌṩÁËÈý¸öº¯ÊýÀ´½ØÈ¡×Ö·û´®£ºsubstr()¡¢mb_substr()ºÍmb_strcut()¡£

substrº¯Êý

substrº¯ÊýÊÇPHPÄÚÖú¯ÊýÖ®Ò» £¬ÓÃÀ´½ØÈ¡×Ö·û´®µÄÒ»²¿·Ö¡£¸Ãº¯ÊýÓÐÈý¸ö²ÎÊý£º×Ö·û´®¡¢ÆðʼλÖúͳ¤¶È¡£

ʾÀý´úÂ룺

$str = "Hello world";
$substr = substr($str, 0, 5);
echo $substr; //Êä³ö Hello

µÇ¼ºó¸´ÖÆ

ÔÚʾÀý´úÂëÖÐ £¬$strÊÇÒª½ØÈ¡µÄ×Ö·û´® £¬0ÊÇÆðʼλÖà £¬5ÊÇÒª½ØÈ¡µÄ³¤¶È¡£substrº¯Êý·µ»Ø½ØÈ¡µÄ×Ö·û´®¡£

mb_substrº¯Êý

mb_substrº¯ÊýÊÇÓÃÓÚ¶à×Ö½Ú×Ö·û¼¯µÄ×Ö·û´®½ØÈ¡º¯Êý¡£ËüµÄ²ÎÊýºÍÓ÷¨Óësubstrº¯ÊýÏàͬ £¬¿ÉÊÇËü¿ÉÒÔ´¦Öóͷ£ÖÐÎĵȶà×Ö½Ú×Ö·û¡£ÐèҪעÖصÄÊÇ £¬Ê¹ÓÃmb_substrº¯ÊýÐèÒªÔÚphp.iniÖпªÆômbstringÀ©Õ¹¡£

ʾÀý´úÂ룺

$str = "ÄãºÃ£¬ÌìÏÂ";
$substr = mb_substr($str, 0, 2, 'utf-8');
echo $substr; //Êä³ö ÄãºÃ

µÇ¼ºó¸´ÖÆ

ÔÚʾÀý´úÂëÖÐ £¬$strÊÇÒª½ØÈ¡µÄ×Ö·û´® £¬0ÊÇÆðʼλÖà £¬2ÊÇÒª½ØÈ¡µÄ³¤¶È £¬’utf-8’ÌåÏÖ×Ö·û´®±àÂë¡£mb_substrº¯Êý·µ»Ø½ØÈ¡µÄ×Ö·û´®¡£

mb_strcutº¯Êý

mb_strcutº¯ÊýÒ²ÊÇÓÃÓÚ¶à×Ö½Ú×Ö·û¼¯µÄ×Ö·û´®½ØÈ¡º¯Êý¡£ËüµÄ²ÎÊýºÍÓ÷¨Óëmb_substrº¯ÊýÏàͬ £¬¿ÉÊÇËü¿ÉÒÔ°ü¹Ü½ØȡЧ¹û²»º¬Óаë¸ö×Ö·û¡£

ʾÀý´úÂ룺

$str = "ÄãºÃ£¬ÌìÏÂ";
$substr = mb_strcut($str, 0, 2, 'utf-8');
echo $substr; //Êä³ö ÄãºÃ

µÇ¼ºó¸´ÖÆ

¶þ¡¢Ê¹ÓÃLaravelµÄ×Ö·û´®²Ù×÷º¯Êý½ØÈ¡×Ö·û

LaravelÌṩÁËÐí¶à×Ö·û´®²Ù×÷º¯Êý £¬¿ÉÒÔ¼ò»¯ÎÒÃǽØÈ¡×Ö·û´®µÄ²Ù×÷¡£

Str::substrº¯Êý

Str::substrº¯ÊýÊÇLaravelµÄ×Ö·û´®½ØÈ¡º¯Êý¡£¸Ãº¯ÊýµÄ²ÎÊýºÍsubstrº¯ÊýµÄ²ÎÊýÏàͬ¡£

ʾÀý´úÂ룺

use Illuminate\Support\Str;

$str = "Hello world";
$substr = Str::substr($str, 0, 5);
echo $substr; //Êä³ö Hello

µÇ¼ºó¸´ÖÆ

ÔÚʾÀý´úÂëÖÐ £¬ÎÒÃÇÐèÒªÏÈÒýÈëStrÀà £¬È»ºó¾Í¿ÉÒÔʹÓÃStr::substrº¯Êý½ØÈ¡×Ö·û´®¡£

Str::limitº¯Êý

Str::limitº¯ÊýÊÇLaravelµÄÏÞÖÆ×Ö·û´®³¤¶Èº¯Êý¡£¸Ãº¯ÊýÓÐÈý¸ö²ÎÊý£º×Ö·û´®¡¢³¤¶ÈºÍ×îºó×Ö·û¡£

ʾÀý´úÂ룺

use Illuminate\Support\Str;

$str = "Hello world";
$limitStr = Str::limit($str, 5, '...');
echo $limitStr; //Êä³ö Hello...

µÇ¼ºó¸´ÖÆ

ÔÚʾÀý´úÂëÖÐ £¬$strÊÇÒª½ØÈ¡µÄ×Ö·û´® £¬5ÊÇÒª½ØÈ¡µÄ³¤¶È £¬’…’ÊÇ×îºó×Ö·û¡£Str::limitº¯Êý·µ»Ø½ØÈ¡µÄ×Ö·û´®¡£

Str::wordsº¯Êý

Str::wordsº¯ÊýÊÇLaravelµÄÏÞÖƵ¥´ÊÊýÄ¿º¯Êý¡£¸Ãº¯ÊýÓÐÈý¸ö²ÎÊý£º×Ö·û´®¡¢µ¥´ÊÊýÄ¿ºÍ×îºó×Ö·û¡£

ʾÀý´úÂ룺

use Illuminate\Support\Str;

$str = "Hello world, how are you doing today?";
$wordsStr = Str::words($str, 3, '...');
echo $wordsStr; //Êä³ö Hello world, how...

µÇ¼ºó¸´ÖÆ

ÔÚʾÀý´úÂëÖÐ £¬$strÊÇÒª½ØÈ¡µÄ×Ö·û´® £¬3ÊÇÒª½ØÈ¡µÄµ¥´ÊÊýÄ¿ £¬’…’ÊÇ×îºó×Ö·û¡£Str::wordsº¯Êý·µ»Ø½ØÈ¡µÄ×Ö·û´®¡£

×ܽá

±¾ÎÄÏÈÈÝÁËÔÚLaravelÖнØÈ¡×Ö·ûµÄÁ½ÖÖÒªÁ죺ʹÓÃPHPÄÚÖú¯ÊýºÍʹÓÃLaravelµÄ×Ö·û´®²Ù×÷º¯Êý¡£Ê¹ÓÃPHPÄÚÖú¯Êý¿ÉÒÔ´¦Öóͷ£¶à×Ö½Ú×Ö·û £¬µ«ÐèÒªÔÚphp.iniÖпªÆômbstringÀ©Õ¹£»Ê¹ÓÃLaravelµÄ×Ö·û´®²Ù×÷º¯Êý¿ÉÒÔ¼ò»¯¿ª·¢ £¬²¢¿ÉÒÔÏÞÖÆ×Ö·û´®³¤¶È»òµ¥´ÊÊýÄ¿¡£Æ¾Ö¤ÏÖʵÐèÇóÑ¡Ôñ²î±ðµÄÒªÁì¼´¿É¡£

ÒÔÉϾÍÊÇlaravelÔõô½ØÈ¡×Ö·ûµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿