尊龙凯时人生就是博

laravelÔõôÌæ»»Ö÷¼üid

laravelÊÇÒ»¿î¼«ÎªÊ¢ÐеÄphp¿ò¼Ü£¬Ëü¾ßÓÐÓÅÃÀµÄÓï·¨ºÍÇ¿Ê¢µÄ¹¦Ð§£¬Äܹ»Ê¹¿ª·¢ÕßÇáËɹ¹½¨¸ßЧµÄwebÓ¦ÓóÌÐò¡£ÔÚlaravelÖУ¬Ã¿¸öÊý¾Ý¿â±í¶¼±ØÐèÓµÓÐÒ»¸öÖ÷¼ü£¬Ò»Ñùƽ³£Ä¬ÒÔΪ”id”×ֶΣ¬²¢ÇÒÕâ¸ö×ֶλ¹±ØÐèÊÇ×ÔÔö×ֶΡ£È»¶ø£¬ÔÚһЩÌض¨µÄÓªÒµ³¡¾°ÖУ¬ÎÒÃÇ¿ÉÄÜÐèÒª½«”id”×Ö¶ÎÌæ»»³ÉÆäËû×Ö¶Î×÷ΪÖ÷¼ü£¬Õâʱ¾ÍÐèÒªÓõ½laravelµÄ¹Ù·½ÎĵµÖÐÌṩµÄÌæ»»Ö÷¼üµÄÒªÁìÁË¡£

Ò»¡¢Åä¾°

ËäÈ»ÔÚLaravelÖÐĬÈÏʹÓÃÖ÷¼ü”id”ÊÇ×î³£¼ûµÄÇéÐΣ¬¿ÉÊÇÓÐʱ¼äÊý¾Ý¿â±íµÄÔ­ÓÐÉè¼Æ¿ÉÄܲ¢²»·ó¹æ·¶»òÕß²»¾ßÓÐΨһÐÔ£¬Õâʱ¼ä¾ÍÐèÒª½«Ô­ÓеÄÖ÷¼üÌ滻ΪÆäËû×ֶΡ£ÀýÈ磬ÔÚijЩӪҵ³¡¾°ÖУ¬¿ÉÄÜÐèҪʹÓÃÓû§µÄÊÖ»úºÅ×÷ΪΨһ±êʶ£¬¶ø²»ÊÇĬÈϵĔid”×ֶΡ£ÈôÊÇʹÓÃĬÈϵĔid”×Ö¶Î×÷ΪÖ÷¼ü£¬ÄÇô¹ØÓÚϵͳÖеÄÓû§¹¤¾ß£¬ÏµÍ³±ãÎÞ·¨Í¨¹ýÊÖ»úºÅ¾ÙÐпìËÙµÄÅÌÎʺÍΨһ¶¨Î»¡£Òò´Ë£¬ÎÒÃÇÐèÒª½«ÊÖ»úºÅ×÷ΪÖ÷¼üÀ´¸üºÃµØ½â¾öÕâ¸öÎÊÌâ¡£

ÔÚLaravelÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý Eloquent ORMÕâ¸öÇ¿Ê¢µÄÊý¾ÝÄ£×ÓÀ´ÇáËɵØÌæ»»Ö÷¼ü¡£

¶þ¡¢Ê¹ÓÃÒªÁì

LaravelÖÐÌṩµÄÌæ»»Ö÷¼üµÄÒªÁìºÜÊǼòÆÓ£¬Ö»ÐèÒªÔÚ¶ÔÓ¦µÄModelÖнç˵һ¸ö$primaryKeyÊôÐÔ£¬²¢½«Æ丳ֵΪÄãÐèÒªÌæ»»³ÉÖ÷¼üµÄ×Ö¶ÎÃû¡£ÀýÈ磬ÈôÊÇÎÒÃÇÐèҪʹÓÃÓû§ÊÖ»úºÅ×÷ΪÖ÷¼ü£¬¾Í¿ÉÒÔÔÚUser ModelÖнç˵ÈçÏ´úÂ룺

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $primaryKey = 'phone';  // ½«phone×Ö¶ÎÉèΪÖ÷¼ü
}

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬ÔÚʹÓÃEloquent ORM¾ÙÐÐÅÌÎÊʱ£¬Laravel¾Í»áĬÈϽ«”phone”×Ö¶Î×÷ΪÖ÷¼üÀ´Ê¹Óá£ÀýÈ磬ÈôÊÇÎÒÃÇÐèÒªÅÌÎÊij¸öÓû§µÄÐÅÏ¢£¬¿ÉÒÔʹÓÃÈçÏ´úÂ룺

$user = App\User::find('13888888888');

µÇ¼ºó¸´ÖÆ

ÕâÑù¾Í¿ÉÒÔͨ¹ýÓû§ÊÖ»úºÅ”13888888888″À´ÅÌÎÊÓû§µÄÐÅÏ¢ÁË¡£

Èý¡¢ÊÊÓÃÇéÐÎ

ÔÚÏÖʵµÄ¿ª·¢ÖУ¬Ìæ»»Ö÷¼üµÄÇéÐοÉÄܲ¢Î´¼¸¼û£¬µ«ÔÚijЩÌض¨µÄÓªÒµ³¡¾°ÖÐÈ´Ê®·ÖÊÊÓá£ÀýÈ磺

¶àÓïÑÔÏîÄ¿£ºÈôÊÇÄãµÄÓ¦ÓÃÐèÒªÖ§³Ö¶àÓïÑÔ£¬ÄÇôһ¸ö³£¼ûµÄÐèÇó¾ÍÊÇʹÓÃij¸ö×Ö¶ÎÀ´×÷Ϊ¶àÓïÑÔϵÄΨһ±êʶ£¬´Ëʱ±ãÐèÒªÌæ»»Ö÷¼ü¡£

ͳһÊý¾ÝÔ´£ºÈôÊÇÄãµÄÓ¦ÓÃÖÐÐèÒª´Ó¶à¸öÊý¾ÝÔ´ÖжÁÈ¡Êý¾Ý£¬²¢ÇÒÕâЩÊý¾ÝÔ´µÄÖ÷¼ü·×ÆçÖ£¬ÄÇôÄã¿ÉÄÜÐèÒª½«ËüÃÇÌæ»»³ÉÒ»¸öͳһµÄÖ÷¼ü¡£

ÆäËû³¡¾°£ºÔÚÏÖʵ¿ª·¢ÖУ¬»¹»áÓÐÐí¶àÆäËûµÄ³¡¾°ÐèÒªÌæ»»Ö÷¼ü£¬Èçƾ֤ÉÌÆ·±àºÅÅÌÎÊÉÌÆ·ÐÅÏ¢µÈ¡£

ËÄ¡¢Ð¡½á

LaravelÌṩÁ˺ÜÊDZã½ÝµÄÌæ»»Ö÷¼üµÄÒªÁ죬¿ÉÒÔÇáËɽâ¾öÔÚһЩÌض¨ÓªÒµ³¡¾°ÖÐÐèҪʹÓ÷ÇĬÈÏÖ÷¼üµÄÎÊÌâ¡£Ö»¹ÜÌæ»»Ö÷¼üÔÚÏÖʵ¿ª·¢ÖÐʹÓõÄÇéÐÎÏà¶Ô½ÏÉÙ£¬µ«ËüȷʵÊÇÒ»ÖֺܺõÄʵÏּƻ®£¬Äܹ»ÉÁ¿ª·¢Õßƾ֤²î±ðµÄÓªÒµÐèÇóÑ¡Ôñ²î±ðµÄÖ÷¼ü£¬ÕâÑù»á¸üºÃµØÅäºÏÓ¦ÓóÌÐòµÄÂß¼­ÐèÇó£¬Í¬Ê±Ò²ÌáÉýÁËÓ¦ÓóÌÐòµÄÐÔÄÜ¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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