尊龙凯时人生就是博

thinkphpÊý¾ÝÌõÊýÔõô²é

thinkphpÊÇÒ»¿îÊ®·ÖÊ¢ÐеÄphp¿ª·¢¿ò¼Ü£¬ËüÌṩÁËÐí¶à±ã½ÝµÄ²Ù×÷ÒªÁìºÍº¯Êý£¬Äܹ»ÉÁ¿ª·¢ÕßÔ½·¢¸ßЧµØ¾ÙÐбà³ÌºÍ¿ª·¢¡£ÔÚ¿ª·¢Àú³ÌÖУ¬ÎÒÃǾ­³£ÐèÒª¶ÔÊý¾Ý¿â¾ÙÐвÙ×÷£¬°üÀ¨¶ÁÈ¡Êý¾Ý¡¢ÐÞ¸ÄÊý¾ÝºÍɾ³ýÊý¾ÝµÈ¡£ÆäÖУ¬Í³¼ÆÊý¾ÝÌõÊýÊÇÒ»¸ö·Ç¾­³£¼ûµÄ²Ù×÷£¬ÏÂÃæ¾ÍÏÈÈÝÒ»ÏÂÔÚthinkphpÖÐÔõÑùÉó²éÊý¾ÝÌõÊý¡£

Êý¾ÝÌõÊýÊÇÖ¸Ò»¸öÊý¾Ý¿â±íÖÐËùÓÐÊý¾ÝµÄÊýÄ¿¡£ÔÚThinkPHPÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃÄ£×ÓÀàÖеÄcount()º¯ÊýÀ´¾ÙÐÐͳ¼ÆÊý¾ÝÌõÊýµÄ²Ù×÷¡£ÏÂÃæÊÇÏêϸµÄʹÓÃÒªÁ죺

ÅþÁ¬Êý¾Ý¿â

Ê×ÏÈ£¬ÐèҪȷ±£ÒѾ­ÀÖ³ÉÅþÁ¬µ½Êý¾Ý¿â£¬²Å»ª¶ÔÆäÖеÄÊý¾Ý¾ÙÐÐÖݪֲÙ×÷¡£ÔÚ¾ÙÐÐÊý¾Ý¿âÅþÁ¬Ç°£¬ÐèÒªÔÚconfig.phpÎļþÖÐÉèÖÃÊý¾Ý¿âÅþÁ¬²ÎÊý£¬ÈçÏÂËùʾ£º

return [
    // Êý¾Ý¿âÀàÐÍ
    'type'            => 'mysql',
    // ЧÀÍÆ÷µØµã
    'hostname'        => '127.0.0.1',
    // Êý¾Ý¿âÃû
    'database'        => 'test',
    // ̞
    'username'        => 'root',
    // ÃÜÂë
    'password'        => '',
    // ¶Ë¿Ú
    'hostport'        => '3306',
    // ...
];

µÇ¼ºó¸´ÖÆ

ÆäÖÐÐèÒªÌîд×Ô¼ºµÄÊý¾Ý¿âÐÅÏ¢¡£

½¨ÉèÄ£×ÓÀà

½ÓÏÂÀ´ÎÒÃÇÐèÒª½¨ÉèÒ»¸öÄ£×ÓÀ࣬ËüÊÇÕë¶ÔÊý¾Ý¿â±íµÄÒ»¸ö²Ù×÷À࣬ÔÚÆäÖпÉÒÔ°üÀ¨ÖݪÖÅÌÎÊ¡¢²åÈë¡¢¸üкÍɾ³ýµÈ²Ù×÷£¬ÕâÀïÎÒÃÇÖ»ÐèÒª¹Øעͳ¼ÆÊý¾ÝÌõÊýµÄ²Ù×÷¡£ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄÄ£×ÓÀà´úÂëʾÀý£º

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

<?php

namespace appmodel;

use thinkModel;

class User extends Model
{
    protected $table = 'user';
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄ´úÂëÖУ¬ÎÒÃǽ¨ÉèÁËÒ»¸öÃûΪUserµÄÄ£×ÓÀ࣬²¢ÇÒÉèÖÃÁËËüËù¶ÔÓ¦µÄÊý¾Ý±íΪuser¡£

ͳ¼ÆÊý¾ÝÌõÊý

ÓÐÁËÄ£×ÓÀàÖ®ºó£¬¾Í¿ÉÒÔÔÚ¿ØÖÆÆ÷ÖÐŲÓÃËüÀ´¶ÔÊý¾Ý¿â¾ÙÐвÙ×÷ÁË¡£ÔÚÕâÀÎÒÃÇ¿ÉÒÔʹÓÃcount()º¯ÊýÀ´¾ÙÐÐͳ¼ÆÊý¾ÝÌõÊýµÄ²Ù×÷£¬´úÂëÈçÏ£º

<?php

namespace appcontroller;

use appmodelUser;
use thinkController;

class Index extends Controller
{
    public function index()
    {
        $userModel = new User();
        $count = $userModel->count();
        echo 'user±íÖеÄÊý¾Ý×ÜÊýΪ£º' . $count;
    }
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇÊ×ÏȽ¨ÉèÁËÒ»¸öUser¹¤¾ß$userModel£¬È»ºóʹÓÃcount()º¯ÊýÀ´Í³¼Æuser±íÖеÄÊý¾Ý×ÜÊý£¬²¢½«Í³¼ÆЧ¹ûÊä³öµ½ä¯ÀÀÆ÷ÖС£

ͨ¹ýÒÔÉϲÙ×÷£¬ÎÒÃǾͿÉÒÔʹÓÃThinkPHPÀ´¾ÙÐÐÊý¾ÝÌõÊýµÄͳ¼ÆÀ²£¡ÐèҪעÖصÄÊÇ£¬ÈôÊÇҪͳ¼ÆÖª×ãÌõ¼þµÄÊý¾ÝÌõÊý£¬¿ÉÒÔÔÚcount()º¯ÊýÖд«ÈëÌõ¼þ²ÎÊý¼´¿É¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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