尊龙凯时人生就是搏

thinkphpÔõÑù»á¼ûÍøÒ³

thinkphpÊÇÒ»¿î»ùÓÚphpÓïÑԵĿªÔ´¿ò¼Ü £¬ËüµÄÉè¼ÆÄ¿µÄÊÇΪÁËÉÁ¿ª·¢ÕßÄܹ»Ô½·¢¸ßЧµØ¿ª·¢webÓ¦ÓóÌÐò¡£ÔÚwebÓ¦ÓóÌÐò¿ª·¢Àú³ÌÖÐ £¬»á¼ûÍøÒ³ÊÇÒ»¸öºÜÊÇÖ÷ÒªµÄ»·½Ú £¬Òò´ËÔÚ±¾ÎÄÖÐ £¬ÎÒÃǽ«Ì½ÌÖÔõÑùʹÓÃthinkphp»á¼ûÍøÒ³¡£

Ê×ÏÈ £¬ÎÒÃÇÐèÒªÏàʶThinkPHPÖеÄ·ÓÉ»úÖÆ¡£Â·ÓɾÍÊǽ«URLÓ³Éäµ½¶ÔÓ¦µÄ¿ØÖÆÆ÷ºÍÒªÁì £¬Òò´ËÔÚ»á¼ûÍøҳʱ £¬ÐèÒªÏÈÉèÖ÷ÓɹæÔò¡£ÔÚThinkPHPÖÐ £¬¿ÉÒÔͨ¹ýÔÚapplication\route.phpÎļþÖÐÉèÖ÷ÓɹæÔò¡£ÀýÈç £¬ÎÒÃÇ¿ÉÒÔÉèÖÃÒÔÏ·ÓɹæÔò£º

<?php use think\Route;

Route::get('/', 'index/index');
Route::get('about', 'index/about');
Route::get('news/:id', 'index/news')->pattern(['id' =&gt; '\d+']);
?&gt;

µÇ¼ºó¸´ÖÆ

ÉÏÊö·ÓɹæÔòÖÐ £¬µÚÒ»Ìõ¹æÔòÌåÏÖ»á¼û¸ùĿ¼ʱ £¬½«ÇëÇóת·¢µ½Index¿ØÖÆÆ÷µÄindexÒªÁì £»µÚ¶þÌõ¹æÔòÌåÏÖ»á¼ûaboutÒ³Ãæʱ £¬½«ÇëÇóת·¢µ½Index¿ØÖÆÆ÷µÄaboutÒªÁì £»µÚÈýÌõ¹æÔòÌåÏÖ»á¼ûnewsÒ³Ãæʱ £¬½«ÇëÇóת·¢µ½Index¿ØÖÆÆ÷µÄnewsÒªÁì £¬²¢½«URLÖеÄid²ÎÊýת´ï¸ø¸ÃÒªÁì¡£

ÔÚÉèÖú÷ÓɹæÔòÖ®ºó £¬ÎÒÃǾͿÉÒÔͨ¹ýURL»á¼ûÍøÒ³ÁË¡£ÀýÈç £¬¹ØÓÚÉÏÊö·ÓɹæÔòÖеĵÚÒ»¸ö¹æÔò £¬ÎÒÃÇ¿ÉÒÔͨ¹ý»á¼ûhttp://localhost/À´»á¼ûÍøÒ³¡£

±ðµÄ £¬ÔÚThinkPHPÖÐ £¬»¹¿ÉÒÔʹÓÃURLº¯ÊýÌìÉú´øÓзÓɹæÔòµÄURL¡£ÀýÈç £¬Ê¹ÓÃÒÔÏ´úÂë¿ÉÒÔÌìÉú»á¼ûaboutÒ³ÃæµÄURL£º

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

<?php $url = url('index/about');
echo $url;
?>

µÇ¼ºó¸´ÖÆ

ÌìÉúµÄURLΪhttp://localhost/about¡£

ÔÚ¾ÙÐÐÍøÒ³»á¼ûʱ £¬»¹ÐèҪעÖØÇå¾²ÐÔ¡£Í¨³£ÇéÐÎÏ £¬Óû§×ª´ïµÄ²ÎÊý¿ÉÄܱ£´æ¶ñÒâ´úÂëµÈÇå¾²Òþ»¼ £¬Òò´ËÐèÒª¶Ôת´ïµÄ²ÎÊý¾ÙÐйýÂ˺ÍÑéÖ¤¡£ÔÚThinkPHPÖÐ £¬¿ÉÒÔʹÓÃinputº¯ÊýÎüÊÕÓû§×ª´ïµÄ²ÎÊý £¬²¢¿ÉÒÔʹÓÃvalidateº¯Êý¶Ô²ÎÊý¾ÙÐÐÑéÖ¤¡£

ÀýÈç £¬Ê¹ÓÃÒÔÏ´úÂë¿ÉÒÔÎüÊÕÓû§×ª´ïµÄid²ÎÊý £¬²¢Ê¹ÓÃvalidateº¯ÊýÑéÖ¤¸Ã²ÎÊýÊÇ·ñΪÊý×Ö£º

<?php $id = input('id');
validate(['id'=>'number'])-&gt;check(['id'=&gt;$id]);
?&gt;

µÇ¼ºó¸´ÖÆ

ÈôÊÇÑé֤ʧ°Ü £¬validateº¯Êý½«Å׳öÒ»¸öValidateExceptionÒì³£ £¬¿ÉÒÔͨ¹ý²¶»ñ¸ÃÒì³£´¦Àí¹ýʧ¡£

×ÛÉÏËùÊö £¬»á¼ûÍøÒ³ÊÇWebÓ¦ÓóÌÐò¿ª·¢µÄÖ÷Òª»·½ÚÖ®Ò»¡£ÔÚʹÓÃThinkPHP¾ÙÐÐÍøÒ³»á¼ûʱ £¬ÐèÒªÉèÖ÷ÓɹæÔò¡¢Ê¹ÓÃURLº¯ÊýÌìÉúURL £¬²¢×¢ÖØÊý¾ÝÇå¾²ÐÔ¡£Ï£Íû±¾ÎÄÄܹ»¶Ô¸÷ÈËÓÐËù×ÊÖú¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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