尊龙凯时人生就是搏

thinkphpÔõÑù×ö·ÖÒ³

Ò»¡¢¿ØÖÆÆ÷ÖеĴúÂëʵÏÖ

ÔÚ¿ØÖÆÆ÷ÒªÁìÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýTP¿ò¼ÜÄÚÖõķÖÒ³Àà\think\paginator\driver\BootstrapÀ´Íê³ÉÊý¾Ý·ÖÒ³¹¦Ð§µÄʵÏÖ¡£ÎÒÃÇ¿ÉÒÔÏÈÅÌÎʳöÒª¾ÙÐзÖÒ³µÄÊý¾Ý£¬È»ºó½«ÅÌÎÊЧ¹ûת´ï¸ø·ÖÒ³À࣬ȻºóŲÓ÷ÖÒ³ÀàµÄrender()ÒªÁì¼´¿É¡£

ÏÂÃæÊÇÒ»¸ö¿ØÖÆÆ÷´úÂëµÄʾÀý£º

use \think\paginator\driver\Bootstrap;

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

public function index()

{

// ÅÌÎÊÎÄÕÂÁбíÊý¾Ý
$articles = Db::name('article')->paginate(10);

// ½«ÅÌÎÊЧ¹ûת´ï¸ø·ÖÒ³Àà
$page = $articles->render();

// ½«·ÖÒ³ºóµÄÊý¾Ýת´ï¸øÄ£°å
$this->assign('articles', $articles);
$this->assign('page', $page);

return $this->fetch('index');

µÇ¼ºó¸´ÖÆ

}

ÿҳÏÔʾÊý¾ÝÁ¿±»Ö¸¶¨Îª10£¬ÕâÊÇÔÚʾÀý´úÂëÖÐͨ¹ýpaginate()ÒªÁìÖеIJÎÊý¾ÙÐÐÉèÖõÄ¡£$articles±äÁ¿Öд洢µÄÊÇÅÌÎʳöÀ´µÄÎÄÕÂÁбíÊý¾Ý£¬$page±äÁ¿Öд洢µÄ¾ÍÊÇ·ÖÒ³ºóµÄHTML´úÂë¡£

¶þ¡¢Ä£°åÖеĴúÂëʵÏÖ

ÔÚÄ£°åÖУ¬ÎÒÃÇ¿ÉÒÔ̫ͨ¹ýÒ³ÀàµÄrender()ÒªÁì·µ»Ø·ÖÒ³HTML´úÂ룬ȻºóÔÚÒ³ÃæÉÏäÖȾ·ÖÒ³µ¼º½¡£

ÏÂÃæÊÇÒ»¸öÄ£°å´úÂëµÄʾÀý£º

{volist name="articles" id="article"}
    <li>{$article.title}</li>
{/volist}

µÇ¼ºó¸´ÖÆ

{$page}

µÇ¼ºó¸´ÖÆ

ÎÒÃÇʹÓÃÁËTP¿ò¼ÜµÄvolist±êÇ©ÔÚ´úÂëÖÐÑ­»·Êä³öÁËÎÄÕÂÁбí¡£ÎÒÃÇʹÓÃ{$page}ÔÚÑ­»·¿¢ÊºóÊä³ö·ÖÒ³µ¼º½µÄHTML´úÂë¡£

ÒÔÉϾÍÊÇthinkphpÔõÑù×ö·ÖÒ³µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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