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

thinkphp¿ò¼ÜÔõô×öÄ£°å

thinkphpÊÇÒ»¿îºÜÊÇÊ¢ÐеÄphp¿ª·¢¿ò¼Ü £¬ËüÒÔÆä¸ßЧµÄÐÔÄÜ¡¢±ã½ÝµÄ²Ù×÷ºÍÍêÕûµÄÎĵµ»ñµÃÁË¿ª·¢ÕßÃǵÄÆÕ±éÈÏ¿É¡£ÆäÖÐ £¬thinkphpµÄÄ£°åÒýÇæÊÇÆäÖ÷ÒªµÄÒ»²¿·Ö £¬±¾ÎĽ«´Ó»ù´¡¿´·¨¡¢Ê¹ÓÃÒªÁìÒÔ¼°×¢ÖØÊÂÏîÈý¸ö·½ÃæÐðÊöÔõÑùÔÚthinkphp¿ò¼ÜÖÐ×öÄ£°å¡£

Ò»¡¢»ù´¡¿´·¨

1.1 ʲôÊÇÄ£°åÒýÇæ

Ä£°åÒýÇæ¾ÍÊÇÒ»¸ö½«Õ¹Ê¾Âß¼­ºÍÓªÒµÂß¼­ÊèÉ¢µÄ¹¤¾ß £¬Ò»ÖÖ½«Ä£°åÎļþºÍ±äÁ¿ÍŽáÌìÉúÊä³öÎĵµµÄ¹¤¾ß¡£ThinkPHPÖÐ £¬ÎÒÃÇ¿ÉÒÔͨ¹ýÄ£°åÒýÇæÀ´½«±äÁ¿äÖȾ½øHTMLÎļþÖÐ £¬ÌìÉú¶¯Ì¬Ò³Ãæ¡£

1.2 Ä£°åÒýÇæÓï·¨

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

ThinkPHPÄÚÖõÄÄ£°åÒýÇæÓï·¨ºÍÆäËûÄ£°åÒýÇæÓï·¨½ÏΪÏàËÆ £¬ÏÂÃæÊÇһЩ³£ÓõÄÓï·¨£º

±äÁ¿Êä³ö£º{$var}

ŲÓÃPHPº¯Êý£º{:date(‘Y-m-d’,time())}

½ç¶¨·û£º¡°{¡±ºÍ¡°}¡±Ö®¼äµÄÄÚÈݶ¼ÊÇÄ£°åÒýÇæ¿ÉÒÔÚ¹Ê͵ÄÄÚÈÝ¡£

¼ÌÐøÄ£°å£º{extend name=¡±Base/base¡±}

½ç˵ģ°å¿é£º{block name=¡±content¡±} ¡­..{/block}

ŲÓÃÄ£°å¿é£º{block name=¡±content¡±} ÊÇÌ滻ǰÃæ½ç˵µÄÄ£°å¿éµÄλÖá£{/block}

1.3 Ä£°å½á¹¹

ThinkPHPÖ÷ÕÅ¡°Ä£°å½á¹¹¡± £¬¼´½«Õû¸öÒ³ÃæµÄ¿ò¼ÜºÍÑùʽ»®·Ö³ÉÈô¸É¸öÎļþ¡£ÕâÀïÎÒÃÇÒԽṹÎļþbase.htmlºÍÄÚÈÝÎļþindex.htmlΪÀý £¬ÑÝʾÔõÑù½«½á¹¹ÎļþºÍÄÚÈÝÎļþÍŽá £¬²¢Êä³öµ½ä¯ÀÀÆ÷ÖС£

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

ÔÚʹÓÃThinkPHPÄ£°åÒýÇæ֮ǰ £¬ÎÒÃÇÐèÒªÔÚÏîÄ¿ÖÐн¨ÊÓͼÎļþ¼Ð £¬²¢ÔÚÉèÖÃÎļþÖÐÖ¸¶¨Ä£°åÒýÇæµÄʹÓ÷½·¨¡£ÏêϸʾÀýÈçÏ£º

2.1 н¨ÊÓͼÎļþ¼Ð

ÔÚThinkPHPµÄÏîÄ¿ÖÐ £¬ÎÒÃÇÐèÒªÔÚ¸ùĿ¼ÏÂн¨Ò»¸öÓÃÀ´´æ·ÅÄ£°åÎļþµÄÊÓͼÎļþ¼Ð £¬Ò»Ñùƽ³£ÃüÃûΪ¡°view¡±»ò¡°template¡±¡£ÊÓͼÎļþ¼ÐµÄĿ¼½á¹¹¿ÉÒÔƾ֤×Ô¼ºµÄÏ°¹ß¾ÙÐл®·Ö¡£

ÀýÈç £¬ÎÒÃÇÔÚviewÎļþ¼ÐÏÂн¨Ò»¸öHomeÎļþ¼Ð £¬ÔÙÔÚHomeÖÐн¨Ò»¸öIndexÎļþ¼Ð £¬²¢½¨Éèindex.htmlºÍbase.htmlÁ½¸öÄ£°åÎļþ¡£

2.2 Ä£°åäÖȾ

ThinkPHPÌṩÁ˶àÖÖäÖȾģ°åµÄ·½·¨ £¬ÀýÈç¿ØÖÆÆ÷Öзµ»ØµÄÖµÖаüÀ¨Ä£°åÎļþÃû £¬¿ò¼Ü»á×Ô¶¯Ñ°ÕÒÖ¸¶¨µÄÄ£°åÎļþ²¢äÖȾ³öЧ¹û¡£

ÔÚIndex¿ØÖÆÆ÷µÄindexÒªÁìÖÐ £¬ÎÒÃÇ¿ÉÒÔ·µ»ØÏÂÃæµÄÊý¾Ý¾ÙÐÐäÖȾ£º

public function index(){
    $this->assign('title','²©¿ÍÊ×Ò³');
    $this->assign('content','ÕâÀïÊDz©¿ÍµÄÊ×Ò³£¡');
    return $this->fetch();
}

µÇ¼ºó¸´ÖÆ

´Ëʱ £¬¿ò¼Ü»á×Ô¶¯äÖȾview/Home/Index/index.htmlÄ£°åÎļþ¡£

2.3 Ä£°å¼ÌÐø

ÔÚThinkPHPÖÐ £¬ÎÒÃÇ¿ÉÒÔͨ¹ýÄ£°å¼ÌÐøµÄ·½·¨ÊµÏÖ´úÂëÖØÓà £¬×ÝÈ»ÓÃbase.htmlÕâ¸ö»ù´¡Ä£°å £¬ÆäËûÄ£°å¶¼¼ÌÐøËü £¬²¢ÔÚ»ù´¡Ä£°åµÄ»ù´¡ÉϾÙÐÐÐ޸ġ£

ÔÚIndexÄ£°åÖÐ £¬ÎÒÃÇÐèÒª¼ÌÐøbase.htmlÄ£°å £¬¼ÌÐøÓï·¨ÈçÏ£º

{extend name="Home/base" /}

µÇ¼ºó¸´ÖÆ

¼ÌÐøÀֳɺó £¬ÎÒÃÇ¿ÉÒÔÔÚÄ£°åÎļþÖÐʹÓÃblockÓï·¨À´Ìæ»»base.htmlÖеÄÄÚÈÝ £¬×ÝÈ»ÓÃ{block name=’content’}…{/block}¾ÙÐÐÇøÓòռλ¡£

{extend name="Home/base" /}
{block name="content"}

  
    
   

{$title}

{$content}

{/block}

µÇ¼ºó¸´ÖÆ

Èý¡¢×¢ÖØÊÂÏî

ÔÚʹÓÃThinkPHPÄ£°åÒýÇæʱ £¬Ò²ÐèҪעÖØÒÔϼ¸µã£º

3.1 ÎļþÃüÃû¹æ·¶

ÔÚThinkPHPÖÐ £¬Ä£°åÎļþµÄÃüÃûÐèÒª×ñÕÕÒÔϹ淶£º

¿ØÖÆÆ÷Ãû/ÒªÁìÃû/Ä£°åÃû.html

ÀýÈç £¬ÔÚIndex¿ØÖÆÆ÷ÖÐ £¬ÎÒÃÇÐèҪŲÓÃload.htmlÄ£°å £¬ÃüÃûӦΪ¡°Index/load.html¡±¡£

3.2 ´úÂë×¢ÊÍ

ÔÚ±àдģ°å´úÂëʱ £¬ÎÒÃǽ¨ÒéʹÓÃÊʵ±µÄ×¢ÊÍ £¬ÕâÑùÔÚ²éÕÒÎÊÌâʱ¿ÉÒÔ¸üÈÝÒ×µØÕÒµ½Ôµ¹ÊÔ­ÓÉ¡£ThikPHPµÄ×¢ÊÍÃûÌúÍHTML×¢ÊÍÃûÌÃÏàͬ¡£

<!-- ÕâÀïÊÇ×¢ÊÍ -->
<div>
    <h1>ÕâÀïÊÇÎÊÌâ</h1>
    <p>ÕâÀïÊÇÄÚÈÝ</p>
</div>

µÇ¼ºó¸´ÖÆ

3.3 Ä£°å´úÂëËõ½ø

Ä£°å´úÂëµÄËõ½ø²»ÊDZØÐèµÄ £¬µ«ÓÅÒìµÄËõ½ø¿ÉÒÔÌá¸ß¿É¶ÁÐÔ £¬Ê¹´úÂëÔ½·¢Ö±¹Û¡£²»Òª½«Õû¸ö´úÂ붼ѹÔÚÒ»ÐÐ £¬¶øÓ¦¸Ã½«ËüÃÇ·Ö³ÉÊʵ±µÄÐÐ £¬Ê¹Æä¸üÒ×ÓÚÔĶÁ¡£

<div>
    <h1>ÕâÀïÊÇÎÊÌâ</h1>
    <p>ÕâÀïÊÇÄÚÈÝ</p>
</div>

µÇ¼ºó¸´ÖÆ

×ܽá

±¾ÎÄÒÔThinkPHPΪÀý £¬Í¨¹ý¶ÔÄ£°åÒýÇæµÄ»ù´¡¿´·¨¡¢Ê¹ÓÃÒªÁìÒÔ¼°×¢ÖØÊÂÏî¾ÙÐÐÏàʶ˵¡£Ï£Íû±¾ÎÄÄܹ»¶Ô¶ÁÕßÏàʶÔõÑùÔÚThinkPHP¿ò¼ÜÖÐ×öÄ£°åÌṩһЩ²Î¿¼¡£

ÒÔÉϾÍÊÇthinkphp¿ò¼ÜÔõô×öÄ£°åµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ