×ðÁú¿­Ê±

thinkphpÖеÄmÒªÁìÔõôʹÓÃ

thinkphpÖеÄmÒªÁìÊÇModelÒªÁìµÄËõд¡£Í¨³£ÓÃÓÚÊý¾Ý¿â²Ù×÷ºÍÊý¾Ý³¤ÆÚ»¯µÄʵÏÖÊÇModel£¬ËüÊÇÓ¦ÓóÌÐòÖеÄÒ»²¿·Ö¡£ModelÀàÔÚthinkphp¿ò¼ÜÖÐÌṩһ×é²Ù×÷Êý¾Ý¿âµÄº¯Êý£¬¿ÉÒÔÇáËÉʵÏÖÔöɾ¸Ä²éµÈ²Ù×÷¡£

ʹÓÃthinkphpµÄmÒªÁì¿ÉÒÔºÜÀû±ãµØ²Ù×÷ModelÀ࣬¾ÙÐÐÊý¾Ý¿âµÄ¶Áд¡£mÒªÁìµÄ»ù±¾Óï·¨ÊÇ£º

$model = M('table');

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬¡¯table¡¯ÊÇÊý¾Ý¿âÖеıíÃû£¬¿ÉÒÔÊÇÒ»¸ö×Ö·û´®»òÕß±äÁ¿¡£

MÒªÁìÓжà¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊýΪÊý¾Ý¿â±íÃû£¬ºóÃæµÄ²ÎÊýΪÊý¾Ý¿âÉèÖÃÐÅÏ¢£¬°üÀ¨Êý¾Ý¿âµÄµØµã¡¢Óû§Ãû¡¢ÃÜÂëµÈ¡£ÈôÊDz»ÉèÖúóÃæµÄ²ÎÊý£¬Ôò»á×Ô¶¯¼ÓÔØÏîÄ¿ÉèÖÃÎļþ¡£

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ʹÓÃmÒªÁì²»µ«¿ÉÒÔ½¨ÉèModelÀàµÄʵÀý£¬»¹¿ÉÒÔ½¨ÉèÆäËû·ÇModelÀàµÄʵÀý¡£Í¨¹ýʹÓÃmÒªÁìʵÀý»¯À࣬Äú¿ÉÒÔ¶Ô¸ÃÀàÖ´ÐÐÏìÓ¦²Ù×÷£¬²¢ÇÒ¿ÉÒÔŲÓÃModelÀàËù½ç˵µÄÒªÁìºÍÊôÐÔ¡£

ÏÂÃæÊÇÒ»¸öʾÀý´úÂ룺

$user = M('user');
$user->where('id=1')->find();

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂ뽨ÉèÁËÒ»¸öÃûΪ$userµÄModelÀàʵÀý£¬²¢Ê¹ÓÃwhere()ÒªÁìºÍfind()ÒªÁìÅÌÎÊÁËÊý¾Ý¿â±íÖÐIDΪ1µÄ¼Í¼£¬È»ºó½«ÅÌÎÊЧ¹û´æ´¢ÔÚ$user±äÁ¿ÖС£

³ýÁËÅÌÎÊ£¬mÒªÁ컹¿ÉÒÔ¾ÙÐÐÊý¾ÝµÄÔöÌí¡¢Ð޸ĺÍɾ³ý¡£ÏÂÃæÊÇÒ»¸öÔöÌíÊý¾ÝµÄʾÀý´úÂ룺

$user = M('user');
$user->username = 'test';
$user->password = md5('123456');
$user->add();

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂ뽨ÉèÁËÒ»¸öÃûΪ$userµÄModelÀàʵÀý£¬²¢Ê¹ÓÃadd()ÒªÁìÏòÊý¾Ý¿â±íÖÐÔöÌíÁËÒ»Ìõ¼Í¼£¬ÆäÖаüÀ¨usernameºÍpasswordÁ½¸ö×ֶΣ¬ÃÜÂëͨ¹ýmd5º¯Êý¼ÓÃÜ¡£

³ýÁËÒÔÉÏʾÀýÖеij£ÓòÙ×÷£¬ModelÀ໹ÌṩÁ˶àÖÖÒªÁ죬Èçjoin()¡¢order()¡¢limit()µÈ£¬¿ÉÒÔ×ÊÖúÎÒÃǸüÎÞаµØ¾ÙÐÐÊý¾Ý¿â²Ù×÷¡£

ÒÔÉϾÍÊÇthinkphpÖеÄmÒªÁìÔõôʹÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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