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

thinkphpÖеÄu()ÒªÁìÔõôʹÓÃ

ThinkPHPÊÇÒ»ÖÖ¹ãÊܽӴýµÄPHP¿ª·¢¿ò¼Ü £¬Äܹ»Îª¿ª·¢Ö°Ô±ÌṩÖÚ¶à±ã½ÝµÄ¹¤¾ßºÍ¹¦Ð§¡£UÒªÁìÊÇÒ»ÖÖÊ®·ÖÊÊÓõļ¼ÇÉ £¬Äܹ»ÓÃÓÚ½¨ÉèURLÁ´½Ó²¢´«Êä²ÎÊý¡£

ͨ¹ýʹÓÃUÒªÁìÔÚThinkPHPÖÐÌìÉú´øÓвÎÊýµÄURLµØµã £¬ÒÔÀû±ãÒ³Ãæ¼äµÄÌøתºÍ²ÎÊýת´ï¡£ÔÚUÒªÁìÖÐ £¬¿ÉÒÔʹÓÃÏÂÃæµÄ²ÎÊý£º

Ä£¿éÃû

¿ØÖÆÆ÷Ãû

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

²Ù×÷Ãû

²ÎÊý

URL²ÎÊý

UÒªÁìµÄ»ù±¾Óï·¨ÈçÏ£º

U('Ä£¿é/¿ØÖÆÆ÷/²Ù×÷','²ÎÊý','URL²ÎÊý');

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÓï·¨ÖÐ £¬Ä£¿éÃû¡¢¿ØÖÆÆ÷ÃûºÍ²Ù×÷ÃûÊDZØÐèµÄ £¬²ÎÊýºÍURL²ÎÊý¶¼ÊÇ¿ÉÑ¡µÄ¡£

¹ØÓÚÄ£¿éÃû¡¢¿ØÖÆÆ÷ÃûºÍ²Ù×÷Ãû £¬¿ÉÒÔͨ¹ýдÈë¶ÔÓ¦µÄ×Ö·û´®À´¾ÙÐд«Èë £¬ÀýÈ磺

U('Home/Index/index');

µÇ¼ºó¸´ÖÆ

ʹÓÃÕâÖÖ·½·¨¿ÉÒÔÌìÉúÒ»¸öÖ¸Ïòindex²Ù×÷µÄÁ´½ÓµØµã¡£

¹ØÓÚ²ÎÊý £¬¿ÉÒÔ½«Æäд³É¹Å°åµÄURL²ÎÊýÐÎʽ £¬ÀýÈ磺

U('Home/Index/index', 'id=1&name=test');

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÁ´½ÓµØµãÖÐ £¬idºÍname¶¼ÊDzÎÊýµÄÃû³Æ £¬1ºÍtestÊDzÎÊýµÄÖµ¡£

³ý´ËÖ®Íâ £¬»¹¿ÉÒÔʹÓÃÊý×éµÄ·½·¨À´×ª´ï²ÎÊý£º

U('Home/Index/index', array('id' => 1, 'name' => 'test'));

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖÐ £¬idºÍname¶¼ÊÇÊý×é¼üµÄÃû³Æ £¬1ºÍtestÊÇÊý×é¼ü¶ÔÓ¦µÄÖµ¡£

×îºó £¬»¹¿ÉÒÔʹÓÃURL²ÎÊý £¬ÀýÈ磺

U('Home/Index/index', '', 'id=1');

µÇ¼ºó¸´ÖÆ

ÕâÑù £¬¾Í¿ÉÒÔÔÚÁ´½ÓµØµãºóÃæÌí¼Óid=1Õâ¸öURL²ÎÊý¡£

ÔÚÏÖʵ¿ª·¢ÖÐ £¬UÒªÁìµÄʹÓó¡¾°ºÜÊÇÆձ顣ÀýÈç £¬ÔÚ¿ØÖÆÆ÷ÖÐ £¬¿ÉÒÔʹÓÃUÒªÁìÀ´ÌìÉú²Ëµ¥Á´½Ó£º

$this->assign('menu', array(
  'Ê×Ò³' => U('Home/Index/index'),
  '¹ØÓÚ×ðÁú¿­Ê±¹ÙÍøµÇ¼' => U('Home/About/index'),
  'ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼' => U('Home/Contact/index')
));

µÇ¼ºó¸´ÖÆ

ÔÚÒ³ÃæÖÐʹÓÃÑ­»·Êä³ö²Ëµ¥£º

<ul>
  <?php foreach($menu as $name => $url): ?>
  <li><a href="<?php echo $url; ?>"><?php echo $name; ?></a></li>
  <?php endforeach; ?>
</ul>

µÇ¼ºó¸´ÖÆ

ͨ¹ýÕâÖÖ·½·¨ £¬¾Í¿ÉÒÔ¿ìËÙµØÌìÉú²Ëµ¥Á´½Ó £¬ÒÔÀû±ãÓû§»á¼ûÒ³Ãæ¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ