尊龙凯时人生就是博

laravel ÅÌÎÊÒ»ÌõÊý¾Ý

laravelÊÇÒ»¸öÊ¢ÐеÄphp¿ò¼Ü£¬ËüÌṩÁËÇ¿Ê¢µÄÊý¾Ý¿âÅÌÎʹ¤¾ß£¬Ê¹µÃÅÌÎÊÒ»ÌõÊý¾Ý±äµÃºÜÊÇÈÝÒס£±¾ÎĽ«ÏÈÈÝlaravelÖÐÔõÑùÅÌÎÊÒ»ÌõÊý¾Ý¡£

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚLaravelÖнç˵һ¸öÄ£×ÓÀࡣģ×ÓÀà¶ÔÓ¦×ÅÊý¾Ý¿âÖеıí£¬Ëü¿ÉÒÔ×ÊÖúÎÒÃǸüÀû±ãµØ¾ÙÐÐÊý¾ÝÅÌÎʺͲÙ×÷¡£ºÃ±È£¬ÈôÊÇÎÒÃÇÓÐÒ»¸öÃûΪ¡°users¡±µÄ±í£¬ÄÇô¿ÉÒÔ½¨ÉèÒ»¸öÃûΪ¡°User¡±µÄÄ£×ÓÀà¡£

½ÓÏÂÀ´£¬ÎÒÃÇÐèҪʹÓÃÄ£×ÓÀàÀ´ÅÌÎÊÊý¾Ý¡£LaravelÌṩÁËÐí¶àÅÌÎÊbuilderÒªÁ죬ÆäÖÐ×î³£ÓõÄÊÇ¡°find¡±ÒªÁì¡£¸ÃÒªÁì½ÓÊÜÒ»¸öÖ÷¼ü×÷Ϊ²ÎÊý£¬²¢ÇÒ·µ»ØÓë¸ÃÖ÷¼ü¶ÔÓ¦µÄÒ»Ìõ¼Í¼¡£

ÀýÈ磬ÈôÊÇÎÒÃÇÒªÅÌÎÊidΪ1µÄÓû§¼Í¼£¬¿ÉÒÔʹÓÃÒÔÏ´úÂ룺

$user = User::find(1);

µÇ¼ºó¸´ÖÆ

ÕâÀ¡°User¡±ÊÇÎÒÃÇÊʲŽç˵µÄÄ£×ÓÀ࣬Ëü¿ÉÒÔͨ¹ý¡°find¡±ÒªÁìÅÌÎÊidΪ1µÄÓû§¼Í¼¡£ÈôÊÇÅÌÎÊÀֳɣ¬$user±äÁ¿½«°üÀ¨Ò»¸öUser¹¤¾ß£¬ÆäÖаüÀ¨Á˸ÃÓû§¼Í¼µÄËùÓÐÊôÐÔ¡£

ÐèҪעÖصÄÊÇ£¬ÈôÊÇÕÒ²»µ½Ö÷¼ü¶ÔÓ¦µÄ¼Í¼£¬findÒªÁ콫·µ»Ønull¡£ÈôÊÇÎÒÃÇÏëÒª¾ÙÐÐÔ½·¢ÎÞаµÄÅÌÎÊ£¬Laravel»¹ÌṩÁËÐí¶àÆäËûµÄÅÌÎÊbuilderÒªÁ죬Èçwhere¡¢orWhere¡¢orderByµÈµÈ¡£

ÀýÈ磬ÈôÊÇÎÒÃÇÒªÅÌÎÊÃû×ÖΪ¡°Tom¡±µÄÓû§¼Í¼£¬¿ÉÒÔʹÓÃÒÔÏ´úÂ룺

$user = User::where('name', 'Tom')->first();

µÇ¼ºó¸´ÖÆ

ÕâÀ¡°where¡±ÒªÁì½ÓÊÜÁ½¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊýÖ¸¶¨ÒªÆ¥ÅäµÄ×Ö¶ÎÃû£¬µÚ¶þ¸ö²ÎÊýÖ¸¶¨ÒªÆ¥ÅäµÄÖµ¡£ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃÇÒªÅÌÎÊÃû×ÖΪ¡°Tom¡±µÄÓû§¼Í¼£¬Òò´ËµÚÒ»¸ö²ÎÊýÊÇ¡°name¡±£¬µÚ¶þ¸ö²ÎÊýÊÇ¡°Tom¡±¡£

¡°first¡±ÒªÁì·µ»ØÆ¥ÅäÅÌÎÊÌõ¼þµÄµÚÒ»Ìõ¼Í¼¡£ÈôÊÇÕÒ²»µ½ÇкÏÌõ¼þµÄ¼Í¼£¬Ëü½«·µ»Ønull¡£

³ýÁË¡°find¡±ºÍ¡°first¡±ÒªÁìÍ⣬Laravel»¹ÌṩÁËÆäËûµÄÅÌÎÊbuilderÒªÁ죬Èç¡°pluck¡±ÒªÁì¿ÉÒÔÖ»·µ»ØÄ£×ÓÖÐÖ¸¶¨µÄ¼òµ¥×ֶεȵÈ¡£Í¨¹ýÊìÁ·ÕÆÎÕÕâЩҪÁ죬ÎÒÃÇ¿ÉÒÔÇáËɵØÅÌÎʺͲÙ×÷Êý¾Ý¿âÖеÄÊý¾Ý¡£

×ÜÖ®£¬LaravelÌṩÁËÒ»Ì×Ç¿Ê¢µÄÊý¾Ý¿âÅÌÎʹ¤¾ß£¬ËüʹµÃÅÌÎÊÒ»ÌõÊý¾Ý±äµÃºÜÊÇÈÝÒס£Í¨¹ý½ç˵ģ×ÓÀàºÍʹÓÃÅÌÎÊbuilderÒªÁ죬ÎÒÃÇ¿ÉÒÔÇáËɵØÅÌÎÊ¡¢²Ù×÷ºÍ´¦ÀíÊý¾Ý¿âÖеÄÊý¾Ý¡£Ï£Íû±¾ÎĶÔÄúÓÐËù×ÊÖú¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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