尊龙凯时人生就是博

thinkphpÎÞÏÞ¼«·ÖÀàµÄÒªÁì

Ëæ×Å»¥ÁªÍøÐÐÒµµÄÒ»Ö±Éú³¤ £¬ÔÚÍøÕ¾¿ª·¢ÖÐʹÓúǫ́ÖÎÀíϵͳÒѳÉΪ±ØÐèÆ·¡£È»¶ø £¬ÍøÕ¾ÔÚÖÎÀíÀú³ÌÖÐ £¬Ëæ×ÅÊý¾ÝµÄÒ»Ö±»ýÀÛ £¬·ÖÀàÔ½À´Ô½¶à £¬Ê¹µÃÔÚÒ³ÃæÉÏչʾʱ £¬Ðèƾ֤·ÖÀà¾ÙÐйéÄÉÕûÀí¡£ÔÆÔÆÒ»À´ £¬±ãÐèҪʹÓõ½·ÖÀàÖÎÀíµÄÒªÁì¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphp¿ò¼ÜµÄÎÞÏÞ¼«·ÖÀàÒªÁì £¬À´ÊµÏÖÍøÕ¾·ÖÀàµÄÖÎÀí¡£

ʲôÊÇthinkphp¿ò¼Ü£¿

thinkphpÊÇÒ»¿îÓÅÒìµÄ¿ò¼ÜÊÖÒÕ £¬¼ÌÐøÁ˹ŰåÍøÕ¾¿ª·¢¿ò¼ÜµÄÓŵã £¬Í¬Ê±ÈÚºÏÁËÄ¿½ñÖ÷Á÷µÄÊÖÒÕÒªÁì¡£thinkphp¿ò¼Ü²»µ«½ö¾ß±¸¸ßЧºÍÀû±ã £¬»¹¾ßÓÐÓÅÒìµÄÀ©Õ¹ÐԺͼæÈÝÐÔ¡£ÔÚʹÓÃthinkphp¿ò¼Üʱ £¬ÎÒÃÇ¿ÉÒÔ×èֹͨÀýµÄ´úÂëÖظ´ £¬Ìá¸ß´úÂëÔËÐÐЧÂÊ¡£

ʲôÊÇÎÞÏÞ¼«·ÖÀࣿ

ÎÞÏÞ¼«·ÖÀàÊÇÖ¸·ÖÀàÊ÷ÐνṹµÄÎÞÏÞÀ©Õ¹ £¬²»ÏÞ²ãÊý¡¢²»ÏÞÊýÄ¿¡£Óë¹Å°åµÄÀο¿·ÖÀà·½·¨Ïà±È £¬ÎÞÏÞ¼«·ÖÀà·ºÆð³ö¸üÇ¿µÄÎÞаÐÔºÍÊý¾ÝÕûÀíµÄ±ã½ÝÐÔ¡£ÔÚÍøÕ¾ÖÐʹÓÃÎÞÏÞ¼«·ÖÀà £¬¿ÉÒÔƾ֤ÐèÒªÔ½·¢Àû±ãµØ¾ÙÐÐÌí¼Ó¡¢Ð޸ĺÍɾ³ý¡£

thinkphp¿ò¼ÜÔõÑùʵÏÖÎÞÏÞ¼«·ÖÀࣿ

thinkphp¿ò¼Üͨ¹ýʹÓõݹéµÄ·½·¨ÊµÏÖÎÞÏÞ¼«·ÖÀà¡£µÝ¹éÊÇÒ»ÖÖƾ֤Ŀ½ñÇéÐÎÖظ´Å²ÓÃ×ÔÉíµÄÒªÁì¡£ÔÚÎÞÏÞ¼«·ÖÀàÖÐ £¬Ã¿¸ö·ÖÀà½áµã¶¼ÓÐ×Ô¼ºµÄidÓ븸½Úµãpid¡£Í¨¹ý¶ÔpidµÄÒ»Ö±µÝ¹é £¬ÎÒÃÇ¿ÉÒÔÇáËɵػñÈ¡ËùÐèµÄ·ÖÀàÐÅÏ¢¡£

´úÂëʵÏÖ

(1) ½¨ÉèÊý¾Ý¿â²¢½¨Éè·ÖÀà±í

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

¼Ù¶¨ÓÐÒ»¸öblogÍøÕ¾ £¬ÐèÒª¶ÔÎÄÕÂƾ֤±êÇ©¾ÙÐзÖÀàÖÎÀí¡£Ê×ÏÈ £¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸ö·ÖÀà±í £¬±íÖаüÀ¨ÒÔÏÂ×ֶΣºid¡¢name¡¢pid¡£ÆäÖÐ £¬idΪ·ÖÀàµÄΨһ±êʶ £¬nameΪ·ÖÀàµÄÃû³Æ £¬pidΪ·ÖÀàµÄ¸¸½Úµãid¡£

(2) ÔÚControllerÖÐÌí¼Ó·ÖÀàÏÔʾҪÁì

public function category() {

//»ñÈ¡·ÖÀàÊý¾Ý

$categories = $this->getCategories();

$this->assign(‘categories’, $categories);

return $this->fetch();

}

(3) ÔÚModelÖÐÌí¼Ó»ñÈ¡·ÖÀàÒªÁì

public function getCategories($pid=0) {

$result = $this->where(‘pid’, $pid)->select();

$categories = array();

foreach ($result as $category) {

$category['sub'] = $this->getCategories($category->id);

$categories[] = $category;

µÇ¼ºó¸´ÖÆ

}

return $categories;

}

(4) ÔÚViewÖÐչʾ·ÖÀàÊý¾Ý

{volist name=”categories” id=”category”}

{$category.name}

{if $category.sub}

<ul>

  {volist name="category.sub" id="sub"}

  <li>{$sub.name}</li>

  {/volist}

</ul>

{/if}

µÇ¼ºó¸´ÖÆ

{/volist}

ͨ¹ýÒÔÉÏ°ì·¨ £¬ÎÒÃǾͿÉÒÔʵÏÖthinkphp¿ò¼ÜµÄÎÞÏÞ¼«·ÖÀàÒªÁì £¬²¢Í¨¹ý¶ÔpidµÄµÝ¹éÅÌÎÊ £¬½«·ÖÀàÐÅÏ¢ÒÔÊ÷ÐνṹÔÚÒ³ÃæÉϾÙÐÐÏÔʾ¡£

×ܽá

ͨ¹ý¶Ô±¾ÎĵÄÔĶÁ £¬ÎÒÃDz»µ«¿ÉÒÔÕÆÎÕthinkphp¿ò¼ÜµÄÎÞÏÞ¼«·ÖÀàÒªÁì £¬»¹¿ÉÒÔÏàʶµÝ¹éÔÚ·ÖÀàÖÎÀíÖеÄÓ¦Óá£ÏÖÔÚ £¬·ÖÀàÖÎÀíÒѳÉΪºǫ́ÖÎÀíϵͳµÄ±Ø±¸¹¦Ð§Ö®Ò»¡£Òò´Ë £¬Ñ§»áthinkphp¿ò¼ÜµÄÎÞÏÞ¼«·ÖÀàÒªÁì £¬¿ÉÒÔÌá¸ßÎÒÃǵĿª·¢Ð§Âʲ¢Ê¹ÎÒÃǵÄÍøÕ¾Ô½·¢¹æ·¶ºÍÒ×Óá£

ÒÔÉϾÍÊÇthinkphpÎÞÏÞ¼«·ÖÀàµÄÒªÁìµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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