尊龙凯时人生就是搏

thinkphp5.0¿çÄ £¿éÔõôÌøת

thinkphpÊÇÒ»¸ö»ùÓÚmvc£¨model-view-controller£©¼Ü¹¹µÄphp¿ò¼Ü£¬¿ÉÓÃÓÚwebÓ¦ÓóÌÐòµÄ¿ª·¢¡£ÔÚthinkphpÖУ¬Ä £¿éµÄ¿´·¨±»ÆÕ±éÔËÓá£ÔÚһЩÖØ´óµÄÓ¦ÓóÌÐòÖУ¬ÐèÒªÔÚ²î±ðµÄÄ £¿éÖ®¼ä¾ÙÐÐÌøת¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphp5.0¾ÙÐпçÄ £¿éµÄÌøת¡£

¸ÅÊö

¿çÄ £¿éÌøתÊÇÖ¸´ÓÒ»¸öÄ £¿éµÄ¿ØÖÆÆ÷Ìøתµ½ÁíÒ»¸öÄ £¿éµÄ¿ØÖÆÆ÷¡£ÔÚthinkPHPÖУ¬Ã¿¸öÄ £¿é¶¼ÓÐ×ÔÁ¦µÄ¿ØÖÆÆ÷ºÍÊÓͼ¡£ÔÚ¾ÙÐÐÌøתǰ£¬ÐèÒªÏȽç˵ºÃ·ÓɹæÔò¡£

½ç˵·ÓɹæÔò

ÔÚthinkPHP5.0ÖУ¬¿ÉÒÔÔÚ·ÓÉÎļþ£¨route.php£©Öнç˵·ÓɹæÔò¡£ÔÚ·ÓɹæÔòÖУ¬¿ÉÒÔ½ç˵¶ÔURLÇëÇóµÄÏìÓ¦£¬°üÀ¨¿çÄ £¿éÌøת¡£

½ç˵·ÓɹæÔòµÄÃûÌÃÈçÏ£º

Route::rule('·ÓɹæÔò','Ä£¿é/¿ØÖÆÆ÷/ÒªÁì','ÇëÇóÀàÐÍ');

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬Â·ÓɹæÔòΪ×Ö·û´®ÀàÐÍ£¬Ä £¿é/¿ØÖÆÆ÷/ÒªÁìΪ¶ÔURLÇëÇóµÄÏìÓ¦£¬ÇëÇóÀàÐÍΪHTTPÒªÁ죬ÀýÈ磺

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

Route::rule('index','index/Index/index','get');

µÇ¼ºó¸´ÖÆ

Õâ¸ö¹æÔòÌåÏÖ£¬µ±ÇëÇóµÄURLΪhttp://www.example.com/indexʱ£¬ÏìÓ¦µÄ¿ØÖÆÆ÷ΪIndex¿ØÖÆÆ÷ϵÄindexÒªÁ죬²¢ÇÒÇëÇóÀàÐÍΪget¡£

ÔÚ¾ÙÐпçÄ £¿éÌøתʱ£¬¿ÉÒÔÔÚ·ÓɹæÔòÖÐʹÓÃÏ»®Ïß¡°_¡±ÌåÏÖÄ £¿éÃû³Æ¡£ÀýÈ磺

Route::rule('jump','admin_Ä£¿é/¿ØÖÆÆ÷/ÒªÁì','get');

µÇ¼ºó¸´ÖÆ

Õâ¸ö¹æÔòÌåÏÖ£¬µ±ÇëÇóµÄURLΪhttp://www.example.com/jumpʱ£¬ÏìÓ¦µÄ¿ØÖÆÆ÷ΪadminÄ £¿éϵĿØÖÆÆ÷µÄÒªÁ죬²¢ÇÒÇëÇóÀàÐÍΪget¡£

ÔÚ½ç˵ºÃ·ÓɹæÔòºó£¬¾Í¿ÉÒÔ¾ÙÐпçÄ £¿éÌøתÁË¡£

¿çÄ £¿éÌøת

ÔÚthinkPHP5.0ÖУ¬¿ÉÒÔʹÓÃϵͳÌṩµÄUrlÖúÊÖº¯Êý¾ÙÐпçÄ £¿éÌøת¡£UrlÖúÊÖº¯Êý¿ÉÒÔƾ֤½ç˵ºÃµÄ·ÓɹæÔòÌìÉú¶ÔÓ¦µÄURLµØµã¡£

ʹÓÃUrlÖúÊÖº¯ÊýµÄÃûÌÃÈçÏ£º

url('·ÓɹæÔò',²ÎÊýÊý×é);

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬Â·ÓɹæÔòΪ½ç˵ºÃµÄ·ÓɹæÔò£¬²ÎÊýÊý×éΪת´ï¸øÄ¿µÄ¿ØÖÆÆ÷µÄ²ÎÊýÊý×é¡£

ÀýÈ磬ÔÚÖ÷Ä £¿éIndex¿ØÖÆÆ÷ÖУ¬ÐèÒªÌøתµ½adminÄ £¿éϵÄUser¿ØÖÆÆ÷µÄaddÒªÁ죬¿ÉÒÔÕâÑùд£º

public function jump(){
    // Ìøתµ½adminÄ£¿éϵÄUser¿ØÖÆÆ÷µÄaddÒªÁì
    $url = url('admin_User/add');
    return $this->redirect($url);
}

µÇ¼ºó¸´ÖÆ

ÔÚÌøתʱ£¬ÈôÊÇÐèҪת´ï²ÎÊý£¬¿ÉÒÔÔÚUrlÖúÊÖº¯ÊýµÄµÚ¶þ¸ö²ÎÊýÖÐÌí¼Ó¡£ÀýÈ磬ÔÚIndex¿ØÖÆÆ÷ÖÐÐèÒªÌøתµ½adminÄ £¿éϵÄUser¿ØÖÆÆ÷µÄeditÒªÁ죬²¢×ª´ï²ÎÊýid=1£¬¿ÉÒÔÕâÑùд£º

public function jump(){
    // Ìøתµ½adminÄ£¿éϵÄUser¿ØÖÆÆ÷µÄeditÒªÁ죬²¢×ª´ï²ÎÊýid=1
    $url = url('admin_User/edit',['id'=>1]);
    return $this->redirect($url);
}

µÇ¼ºó¸´ÖÆ

ÔÚÄ¿µÄ¿ØÖÆÆ÷ÖУ¬¿ÉÒÔʹÓÃinput()º¯Êý»ñÈ¡²ÎÊýÖµ¡£ÀýÈ磬ÔÚUser¿ØÖÆÆ÷µÄeditÒªÁìÖУ¬»ñÈ¡id²ÎÊýÖµµÄ´úÂëÈçÏ£º

public function edit(){
    // »ñÈ¡id²ÎÊýÖµ
    $id = input('id');
    // ¸³Öµµ½ÊÓͼÖÐ
    $this->assign('id',$id);
    // äÖȾÊÓͼ
    return $this->fetch();
}

µÇ¼ºó¸´ÖÆ

×ܽá

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃthinkPHP5.0¾ÙÐпçÄ £¿éµÄÌøת¡£ÔÚ¾ÙÐÐÌøתǰ£¬ÐèÒªÏȽç˵ºÃ·ÓɹæÔò£¬È»ºóʹÓÃUrlÖúÊÖº¯ÊýÌìÉúÌøתµÄURLµØµã¡£ÔÚÄ¿µÄ¿ØÖÆÆ÷ÖУ¬¿ÉÒÔʹÓÃinput()º¯Êý»ñÈ¡Ìøתʱת´ïµÄ²ÎÊýÖµ¡£

ÒÔÉϾÍÊÇthinkphp5.0¿çÄ £¿éÔõôÌøתµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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