尊龙凯时人生就是博

laravel ÅÌÎÊ»ñÈ¡Êý×é

laravelÊÇÒ»¿îÊ¢ÐеÄphp webÓ¦ÓóÌÐò¿ò¼Ü¡£ËüÌṩÁËÐí¶à¹¤¾ßºÍº¯Êý£¬¿ÉÒÔÇáËɵش¦ÀíÊý¾Ý¿âÅÌÎÊ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlaravelÖÐʹÓÃÅÌÎÊÀ´»ñÈ¡Êý×é¡£

ÔÚLaravelÖУ¬¿ÉÒÔʹÓÃDBÀàÀ´Ö´ÐÐÊý¾Ý¿âÅÌÎÊ¡£¸ÃÀàÌṩÁËÐí¶à±ã½ÝµÄº¯Êý£¬ÓÃÓÚÖ´ÐÐÖÖÖÖÀàÐ͵ÄÅÌÎÊ¡ £¿ÉÒÔʹÓÃDB::table()º¯Êý»ñÈ¡Ò»¸öÅÌÎʹ¹½¨Æ÷£¬Ê¹ÓÃËüÀ´¹¹½¨ÖØ´óµÄÅÌÎÊ¡£

ÒÔÏÂÊÇÒ»¸öʾÀý£¬Õ¹Ê¾ÔõÑùʹÓÃÅÌÎʹ¹½¨Æ÷´ÓÊý¾Ý¿âÖлñÈ¡Ò»¸öÊý×飺

$users = DB::table(‘users’)->pluck(‘name’);

ÔÚÒÔÉÏʾÀýÖУ¬ÎÒÃÇͨ¹ýʹÓÃpluck()º¯ÊýÀ´»ñÈ¡´Óusers±íÖлñÈ¡name×ֶεÄÊý×é¡£ÎÒÃÇʹÓÃDB::table()º¯Êý»ñÈ¡ÁËÒ»¸öÅÌÎʹ¹½¨Æ÷£¬È»ºóʹÓÃËüÀ´¹¹½¨ÅÌÎÊ¡£

ÒÔÏÂÊÇÁíÒ»¸öʾÀý£¬ËüչʾÔõÑùʹÓÃÅÌÎʹ¹½¨Æ÷À´»ñÈ¡¶à¸ö×ֶεÄÊý×飺

$users = DB::table(‘users’)->select(‘name’, ’email’)->get();

ÔÚÒÔÉÏʾÀýÖУ¬ÎÒÃÇʹÓÃselect()º¯ÊýÀ´Ö¸¶¨ÎÒÃÇÒª»ñÈ¡µÄ×ֶΡ£È»ºóʹÓÃget()º¯ÊýÀ´Ö´ÐÐÅÌÎʲ¢·µ»ØЧ¹ûÊý×é¡£

ËäÈ»£¬ÎÒÃÇÒ²¿ÉÒÔÔÚÅÌÎÊÖÐʹÓÃÔ¼ÊøÌõ¼þ£¬ÀýÈçʹÓÃwhere()º¯ÊýÀ´ÏÞÖÆÅÌÎÊЧ¹û£º

$users = DB::table(‘users’)->where(‘name’, ‘John’)->get();

ÔÚÒÔÉÏʾÀýÖУ¬ÎÒÃÇʹÓÃwhere()º¯ÊýÀ´Ô¼ÊøÅÌÎÊ£¬Ö»·µ»Øname×Ö¶ÎֵΪJohnµÄÐС£

ÎÒÃÇ»¹¿ÉÒÔʹÓÃorderBy()º¯Êý¶ÔЧ¹û¾ÙÐÐÅÅÐò£º

$users = DB::table(‘users’)->orderBy(‘name’, ‘desc’)->get();

ÔÚÒÔÉÏʾÀýÖУ¬ÎÒÃÇʹÓÃorderBy()º¯Êý½«Ð§¹ûƾ֤name×ֶξÙÐе¹ÐòÅÅÐò¡£

ÐèҪעÖصÄÊÇ£¬ÉÏÊöʾÀýÖеÄget()º¯Êý·µ»ØµÄÊÇÒ»¸öÊý×鹤¾ß¡£ÈôÊÇÒª½«Êý×éת»¯ÎªÍ¨Ë×µÄPHPÊý×飬¿ÉÒÔʹÓÃtoArray()º¯Êý£º

$users = DB::table(‘users’)->select(‘name’, ’email’)->get()->toArray();

ÔÚÒÔÉÏʾÀýÖУ¬ÎÒÃÇÔÚget()º¯ÊýºóʹÓÃtoArray()º¯Êý£¬½«»ñÈ¡µ½µÄ¹¤¾ßת»¯ÎªÍ¨Ë×µÄPHPÊý×é¡£

×ܽáһϣ¬ÒÔÉÏÊÇʹÓÃLaravelÅÌÎʹ¹½¨Æ÷»ñÈ¡Êý×éµÄһЩʾÀý¡£ÕâЩº¯Êý¿ÉÒÔ×ÊÖúÎÒÃÇÇáËɵع¹½¨ÖØ´óµÄÅÌÎÊ£¬ÒÔ»ñÈ¡ÎÒÃÇÐèÒªµÄÊý¾Ý¡£LaravelÇ¿Ê¢µÄÅÌÎʹ¦Ð§ÊÇÕâ¸ö¿ò¼ÜÊܵ½ÆÕ±é½Ó´ýµÄÖ÷ÒªÔµ¹ÊÔ­ÓÉÖ®Ò»¡£

ÒÔÉϾÍÊÇlaravel ÅÌÎÊ»ñÈ¡Êý×éµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

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

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

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