×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÖÐÒªÁìŲÓÃ

thinkphpÊÇÒ»¸öÓÅÒìµÄphp¿ª·¢¿ò¼Ü £¬ËüÔÚÒªÁìŲÓÃÉÏÌṩÁËÐí¶àÀû±ãµÄ¹¦Ð§ £¬±¾ÎĽ«ÎªÄãÏÈÈÝÆäÖеÄһЩҪÁìŲÓÃÒªÁì¡£

Ò»¡¢¿ØÖÆÆ÷ÒªÁìŲÓÃ

ÔÚThinkPHPÖÐ £¬¿ØÖÆÆ÷ÊÇMVC¿ò¼ÜÖеĽ¹µã´úÂëÖ®Ò»¡£¿ØÖÆÆ÷ÖÐÓÐÐí¶à¿É¹©Ê¹ÓõÄÒªÁì¡£ÎÒÃÇ¿ÉÒÔÏñÏÂÃæÕâÑùÔÚ¿ØÖÆÆ÷Öнç˵һ¸öÒªÁ죺

public function index(){
    echo 'ÕâÊÇ¿ØÖÆÆ÷ÖеÄindexÒªÁì';
}

µÇ¼ºó¸´ÖÆ

È»ºóÎÒÃÇ¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÊäÈëÍøÖ·À´Å²ÓÃÕâ¸öÒªÁ죺

http://localhost/tp5/index.php/index/index

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬index.phpÊÇThinkPHP¿ò¼ÜµÄÈë¿ÚÎļþ £¬indexÊÇ¿ØÖÆÆ÷Ãû³Æ £¬indexÊǸÿØÖÆÆ÷µÄÒªÁìÃû³Æ¡£ÕâÀïÐèҪעÖصÄÊÇ £¬ÔÚThinkPHP5¿ò¼ÜÖÐ £¬ÓÉÓÚ·Óɵı£´æ £¬ÉÏÃæµÄÍøÖ·¿ÉÒÔ¼ò»¯Îª£º

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

http://localhost/tp5/public/index/index

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬tp5ÊÇÏîÄ¿µÄ¸ùĿ¼Ãû³Æ £¬publicÊÇÏîÄ¿µÄÈë¿ÚĿ¼Ãû³Æ¡£

¶þ¡¢Ä£×ÓÒªÁìŲÓÃ

ÔÚThinkPHPÖÐ £¬Ä£×ÓÊÇÅþÁ¬¿ØÖÆÆ÷ºÍÊý¾Ý¿âÖ®¼äµÄÇÅÁº¡£ÔÚÄ£×ÓÖÐ £¬ÎÒÃÇ¿ÉÒÔ½ç˵Ðí¶à³£ÓõÄÒªÁìÀ´²Ù×÷Êý¾Ý¿â £¬ÀýÈçÔöɾ¸Ä²éµÈ¡£ÎÒÃÇ¿ÉÒÔÏñÏÂÃæÕâÑùÔÚÄ£×ÓÖнç˵һ¸öÒªÁ죺

public function getList(){
    $list = $this -> select();
    return $list;
}

µÇ¼ºó¸´ÖÆ

Õâ¸öÒªÁì¿ÉÒÔÓÃÀ´ÅÌÎÊÊý¾Ý¿âÖеļͼ £¬²¢·µ»ØÒ»¸öÊý×é¡£ÎÒÃÇ¿ÉÒÔÔÚ¿ØÖÆÆ÷ÖÐŲÓÃÕâ¸öÒªÁìÀ´»ñÈ¡ÅÌÎÊЧ¹û£º

public function index(){
    $model = new DemoModel();
    $list = $model -> getList();
    $this -> assign('list', $list);
    return $this -> fetch();
}

µÇ¼ºó¸´ÖÆ

ÔÚÅÌÎÊÀֳɺó £¬ÎÒÃǽ«Ð§¹û¸³Öµ¸øÄ£°å £¬È»ºóʹÓÃfetch()ÒªÁìÀ´ÏÔʾÅÌÎÊЧ¹û £¬ÒÔÊÇÎÒÃÇ¿ÉÒÔÔÚÄ£°åÖÐʹÓÃlist±äÁ¿À´ÏÔʾÅÌÎÊЧ¹û¡£

Èý¡¢ÖúÊÖº¯ÊýŲÓÃ

ÔÚThinkPHPÖÐ £¬ÖúÊÖº¯ÊýÊÇÒ»×é¼òÆӵĺ¯Êý £¬ËüÃÇ¿ÉÒÔÓÃÀ´´¦ÀíÏîÄ¿Öеij£ÓòÙ×÷¡£ÕâЩº¯Êý¶¼±»½ç˵ÔÚÎļþhelper.phpÖÐ £¬ÎÒÃÇ¿ÉÒÔÖ±½ÓŲÓÃÕâЩº¯ÊýÀ´Íê³ÉһЩ²Ù×÷¡£ÀýÈ磺

$data = [
    'name' => 'ThinkPHP',
    'email' => 'thinkphp@qq.com',
];
dump($data);

µÇ¼ºó¸´ÖÆ

Õâ¸öÀý×ÓʹÓÃÁËdump()º¯ÊýÀ´Õ¹Ê¾$dataÊý×éµÄÄÚÈÝ¡£dump()º¯ÊýÊÇÒ»¸öºÜÊǺÃÓõÄÖúÊÖº¯Êý £¬Ëü¿ÉÒÔÓÃÀ´´òÓ¡Êý¾ÝµÄ½á¹¹ºÍÄÚÈÝ¡£

ËÄ¡¢TPÄÚÖÃÒªÁìŲÓÃ

³ýÁËÒÔÉϵÄÓ÷¨ £¬ThinkPHP»¹ÌṩÁËһЩÆäËûµÄÒªÁìŲÓ÷½·¨ £¬ÀýÈ磺

TPµÄÈÕÖ¾ÒªÁ죺

ÔÚThinkPHPÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃLogÀàÀ´¼Í¼ϵͳÈÕÖ¾¡£ÀýÈ磺

Log::record('ÕâÊÇÒ»ÌõϵͳÈÕÖ¾');

µÇ¼ºó¸´ÖÆ

Õâ¸öÒªÁ콫»áÍùϵͳÈÕÖ¾ÎļþÖÐдÈëÒ»Ìõ¼Í¼¡£

TPµÄ»º´æÒªÁ죺

ÔÚThinkPHPÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃCacheÀàÀ´ÊµÏÖ»º´æ¹¦Ð§¡£ÀýÈ磺

Cache::set('name', 'Tom', 3600);

µÇ¼ºó¸´ÖÆ

Õâ¸öÒªÁì¿ÉÒÔ½«Êý¾Ý»º´æµ½CacheÖÐ £¬²¢ÉèÖÃÓÐÓÃÆÚΪ3600Ãë¡£

Èý¡¢×ܽá

ͨ¹ýÒÔÉϵÄÏÈÈÝ £¬ÎÒÃÇ¿ÉÒÔ¿´µ½ £¬ThinkPHPÌṩÁËÐí¶àÀû±ãµÄÒªÁìŲÓ÷½·¨ £¬Äܹ»×ÊÖúÎÒÃǸüºÃµØÍê³ÉÏîÄ¿ÖеIJÙ×÷¡£ÎÒÃÇÒªÊìÁ·ÕÆÎÕÕâЩҪÁìµÄʹÓà £¬²Å»ª¸üºÃµØʹÓÃThinkPHP¿ò¼Ü¾ÙÐпª·¢¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ