尊龙凯时人生就是博

thinkphpʵÏÖ²î±ðÄ £¿éµÄÅþÁ¬

Ëæ×ÅÍøÂçÊÖÒÕµÄÉú³¤£¬Ô½À´Ô½¶àµÄÍøÕ¾ºÍÓ¦ÓóÌÐò½ÓÄÉÁËÄ £¿é»¯µÄ¿ª·¢·½·¨¡£ÔÚwebÓ¦ÓóÌÐòÖУ¬²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬ÊÇÊ®·ÖÖ÷ÒªµÄ£¬¶øthinkphp×÷Ϊһ¿îÊ¢ÐеÄphp¿ò¼Ü£¬ÌṩÁËÐí¶àÀû±ãµÄÒªÁìÀ´ÊµÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphpʵÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬£¬²¢ÒÔÒ»¸ö¼òÆÓµÄʵÀý¾ÙÐÐ˵Ã÷¡£

Ò»¡¢ÅþÁ¬·½·¨

thinkphpÌṩÁ˶àÖÖÅþÁ¬·½·¨£¬°üÀ¨URLÅþÁ¬¡¢¿ØÖÆÆ÷ÅþÁ¬ºÍ²Ù×÷ÒªÁìÅþÁ¬¡£

URLÅþÁ¬

ÔÚthinkphpÖУ¬Ä¬ÈÏÇéÐÎÏ¿ÉÒÔͨ¹ýURLÅþÁ¬À´»á¼ûÍøÕ¾µÄ²î±ðÄ £¿é¡£URLÅþÅþÁÚÄÉ¡°ÓòÃû/Ä £¿é/¿ØÖÆÆ÷/²Ù×÷¡±ÕâÖÖ·½·¨À´¾ÙÐÐÅþÁ¬£¬ÆäÖС°ÓòÃû¡±ÊÇÖ¸ÍøÕ¾µÄÓòÃû»òIPµØµã£¬¡°Ä £¿é¡±ÊÇÖ¸³ÌÐòÖеIJî±ðÄ £¿é£¬¡°¿ØÖÆÆ÷¡±ÊÇÖ¸Ä £¿éÖеIJî±ð¿ØÖÆÆ÷£¬¡°²Ù×÷¡±ÊÇÖ¸¿ØÖÆÆ÷ÖеIJî±ð²Ù×÷ÒªÁì¡£ÀýÈ磬ÏÂÃæÊÇÒ»¸öURLÅþÁ¬µÄʾÀý£º

http://localhost/index.php/Home/Index/index.html

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

ÆäÖУ¬¡°localhost¡±ÊÇÖ¸µ±ÌïÖ÷»ú£¬¡°Home¡±ÊÇÖ¸³ÌÐòÖеÄÄ £¿é£¬¡°Index¡±ÊÇÖ¸Ä £¿éÖеĿØÖÆÆ÷£¬¡°index¡±ÊÇÖ¸¿ØÖÆÆ÷ÖеIJÙ×÷ÒªÁì¡ £¿ÉÒÔ¿´µ½£¬Í¨¹ýURLÅþÁ¬¿ÉÒÔ»á¼û²î±ðÄ £¿é¡¢¿ØÖÆÆ÷ºÍ²Ù×÷ÒªÁ죬ʮ·ÖÀû±ã¡£

¿ØÖÆÆ÷ÅþÁ¬

³ýÁËͨ¹ýURLÅþÁ¬À´»á¼û²î±ðÄ £¿é¡¢¿ØÖÆÆ÷ºÍ²Ù×÷ÒªÁìÖ®Í⣬thinkphp»¹ÌṩÁË¿ØÖÆÆ÷ÅþÁ¬µÄ·½·¨¡ £¿ØÖÆÆ÷ÅþÁ¬ÊÇָͨ¹ý³ÌÐòÖеIJî±ð¿ØÖÆÆ÷À´ÅþÁ¬²î±ðµÄÄ £¿é¡£ÀýÈ磬ÏÂÃæÊÇÒ»¸ö¿ØÖÆÆ÷ÅþÁ¬µÄʾÀý£º

$this->redirect(‘Admin/Index/index’);

ÆäÖУ¬¡°Admin¡±ÊÇÖ¸³ÌÐòÖеÄÄ £¿é£¬¡°Index¡±ÊÇÖ¸Ä £¿éÖеĿØÖÆÆ÷£¬¡°index¡±ÊÇÖ¸¿ØÖÆÆ÷ÖеIJÙ×÷ÒªÁì¡ £¿ÉÒÔ¿´µ½£¬ÔÚ¿ØÖÆÆ÷ÖÐʹÓÃredirectÒªÁì¿ÉÒÔʵÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬¡£

²Ù×÷ÒªÁìÅþÁ¬

³ýÁËͨ¹ýURLÅþÁ¬ºÍ¿ØÖÆÆ÷ÅþÁ¬Ö®Í⣬thinkphp»¹ÌṩÁ˲Ù×÷ÒªÁìÅþÁ¬µÄ·½·¨¡£²Ù×÷ÒªÁìÅþÁ¬ÊÇָͨ¹ý³ÌÐòÖеIJî±ð²Ù×÷ÒªÁìÀ´ÅþÁ¬²î±ðµÄ¿ØÖÆÆ÷¡£ÀýÈ磬ÏÂÃæÊÇÒ»¸ö²Ù×÷ÒªÁìÅþÁ¬µÄʾÀý£º

$action = ‘index’;

$this->$action();

ÆäÖУ¬¡°index¡±ÊÇÖ¸¿ØÖÆÆ÷ÖеIJÙ×÷ÒªÁì¡ £¿ÉÒÔ¿´µ½£¬ÔÚ¿ØÖÆÆ÷ÖÐʹÓñäÁ¿ºÍÒªÁìµÄÍŽá¿ÉÒÔʵÏÖ²î±ð¿ØÖÆÆ÷Ö®¼äµÄÅþÁ¬¡£

¶þ¡¢ÊµÀýÆÊÎö

ÏÂÃæÒÔÒ»¸ö¼òÆÓµÄʵÀýÀ´ËµÃ÷ÔõÑùʹÓÃthinkphpʵÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬¡£¼ÙÉèÎÒÃǵijÌÐòÖÐÓÐÁ½¸öÄ £¿é£¬»®·ÖÊÇ¡°Home¡±ºÍ¡°Admin¡±£¬ÆäÖС°Home¡±Ä £¿éÓÃÓÚÏÔʾǰ̨½çÃ棬¡°Admin¡±Ä £¿éÓÃÓÚÏÔʾºǫ́ÖÎÀí½çÃæ¡£

½¨ÉèÁ½¸öÄ £¿é

Ê×ÏÈ£¬ÔÚthinkphpµÄ¿ª·¢ÇéÐÎÏ£¬ÎÒÃÇÐèÒª½¨ÉèÁ½¸öÄ £¿é£¬»®·ÖÊÇ¡°Home¡±ºÍ¡°Admin¡±¡£ÔÚthinkphpÖУ¬½¨ÉèÄ £¿éµÄÒªÁìºÜ¼òÆÓ£¬Ö»ÐèÒªÔÚ¡°Application¡±Ä¿Â¼Ï½¨ÉèÏìÓ¦µÄÄ £¿éĿ¼£¬²¢ÔÚĿ¼Ï½¨Éè¡°Controller¡±ºÍ¡°View¡±Ä¿Â¼¼´¿É¡£ÏêϸµÄ²Ù×÷ÈçÏ£º

£¨1£© ½¨Éè¡°Home¡±Ä £¿é

ÔÚÍâµØµÄ¡°www¡±Ä¿Â¼Ï½¨ÉèÃûΪ¡°thinkphpdemo¡±µÄÎļþ¼Ð£¬½øÈë¸ÃÎļþ¼Ð£¬²¢Ð½¨¡°Application/Home¡±ºÍ¡°Public¡±Ä¿Â¼¡£

£¨2£© ½¨Éè¡°Admin¡±Ä £¿é

ÔÚ¡°thinkphpdemo/Application¡±Ä¿Â¼Ï½¨ÉèÃûΪ¡°Admin¡±µÄĿ¼£¬²¢ÔÚ¸ÃĿ¼Ï½¨Éè¡°Controller¡±ºÍ¡°View¡±Ä¿Â¼¡£

½¨Éè¿ØÖÆÆ÷ºÍ²Ù×÷ÒªÁì

ÔÚ¡°Home¡±Ä £¿éºÍ¡°Admin¡±Ä £¿éÏ»®·Ö½¨Éè¿ØÖÆÆ÷ºÍ²Ù×÷ÒªÁ죬ÓÃÓÚÏÔʾ²î±ðµÄÒ³Ãæ¡£ÏêϸµÄ²Ù×÷ÈçÏ£º

£¨1£© ½¨Éè¡°Home/Index¡±¿ØÖÆÆ÷

ÔÚ¡°Home¡±Ä £¿éϽ¨Éè¡°IndexController.class.php¡±Îļþ£¬Ð´ÈëÒÔÏ´úÂ룺

<?php
namespace HomeController;
use ThinkController;
class IndexController extends Controller {
    public function index(){
        $this->display();
    }
}

µÇ¼ºó¸´ÖÆ

£¨2£© ½¨Éè¡°Admin/Index¡±¿ØÖÆÆ÷

ÔÚ¡°Admin¡±Ä £¿éϽ¨Éè¡°IndexController.class.php¡±Îļþ£¬Ð´ÈëÒÔÏ´úÂ룺

<?php
namespace AdminController;
use ThinkController;
class IndexController extends Controller {
    public function index(){
        $this->display();
    }
}

µÇ¼ºó¸´ÖÆ

½¨ÉèÄ£°åÎļþ

ÔÚ¡°Home¡±Ä £¿éϽ¨ÉèÃûΪ¡°Index.html¡±µÄÄ£°åÎļþ£¬ÓÃÓÚÏÔʾǰ̨½çÃæ¡£ÔÚ¡°Admin¡±Ä £¿éϽ¨ÉèÃûΪ¡°Index.html¡±µÄÄ£°åÎļþ£¬ÓÃÓÚÏÔʾºǫ́ÖÎÀí½çÃæ¡£ÏêϸµÄ²Ù×÷ÈçÏ£º

£¨1£© ½¨Éè¡°Home/Index.html¡±Ä£°åÎļþ

ÔÚ¡°Home/View/Index¡±Ä¿Â¼Ï½¨ÉèÃûΪ¡°Index.html¡±µÄÄ£°åÎļþ£¬Ð´ÈëÒÔÏ´úÂ룺

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ǰ̨½çÃæ</title>
</head>
<body>
    <h1>½Ó´ýÀ´µ½Ç°Ì¨½çÃæ</h1>
</body>
</html>

µÇ¼ºó¸´ÖÆ

£¨2£© ½¨Éè¡°Admin/Index.html¡±Ä£°åÎļþ

ÔÚ¡°Admin/View/Index¡±Ä¿Â¼Ï½¨ÉèÃûΪ¡°Index.html¡±µÄÄ£°åÎļþ£¬Ð´ÈëÒÔÏ´úÂ룺

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ºǫ́ÖÎÀí½çÃæ</title>
</head>
<body>
    <h1>½Ó´ýÀ´µ½ºǫ́ÖÎÀí½çÃæ</h1>
</body>
</html>

µÇ¼ºó¸´ÖÆ

²âÊÔ³ÌÐò

ÔÚ½«¿ØÖÆÆ÷ºÍÄ£°åÎļþ¶¼½¨ÉèºÃÖ®ºó£¬¾Í¿ÉÒÔͨ¹ýURLÅþÁ¬¡¢¿ØÖÆÆ÷ÅþÁ¬ºÍ²Ù×÷ÒªÁìÅþÁ¬À´ÊµÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬ÁË¡£

£¨1£© ͨ¹ýURLÅþÁ¬À´»á¼û²î±ðÄ £¿é

ÔÚä¯ÀÀÆ÷ÖÐÊäÈëÒÔÏÂURLµØµãÀ´»á¼û²î±ðµÄÄ £¿é£º

ǰ̨½çÃ棺http://localhost/thinkphpdemo/index.php/Home/Index/index

ºǫ́ÖÎÀí½çÃ棺http://localhost/thinkphpdemo/index.php/Admin/Index/index

£¨2£© ͨ¹ý¿ØÖÆÆ÷ÅþÁ¬À´»á¼û²î±ðÄ £¿é

ÔÚ¡°Home¡±Ä £¿éϵĿØÖÆÆ÷¡°IndexController¡±ÖУ¬Ìí¼ÓÒÔÏ´úÂ룺

// Ìøתµ½ºǫ́ÖÎÀí½çÃæ
public function admin(){
    $this->redirect('Admin/Index/index');
}

µÇ¼ºó¸´ÖÆ

ÔÚä¯ÀÀÆ÷ÖÐÊäÈëÒÔÏÂURLµØµãÀ´ÊµÏÖ¿ØÖÆÆ÷ÅþÁ¬£¬Ìøתµ½ºǫ́ÖÎÀí½çÃ棺

http://localhost/thinkphpdemo/index.php/Home/Index/admin

£¨3£© ͨ¹ý²Ù×÷ÒªÁìÅþÁ¬À´»á¼û²î±ðÄ £¿é

ÔÚ¡°Home¡±Ä £¿éϵĿØÖÆÆ÷¡°IndexController¡±ÖУ¬Ìí¼ÓÒÔÏ´úÂ룺

// Ìøתµ½ºǫ́ÖÎÀí½çÃæ
public function admin(){
    $this->redirect('Admin/Index/index');
}

// ͨ¹ý²Ù×÷ÒªÁìÅþÁ¬À´Ìøתµ½ºǫ́ÖÎÀí½çÃæ
public function gadmin(){
    $action = 'admin';
    $this->$action();
}

µÇ¼ºó¸´ÖÆ

ÔÚä¯ÀÀÆ÷ÖÐÊäÈëÒÔÏÂURLµØµãÀ´ÊµÏÖ²Ù×÷ÒªÁìÅþÁ¬£¬Ìøתµ½ºǫ́ÖÎÀí½çÃ棺

http://localhost/thinkphpdemo/index.php/Home/Index/gadmin

ͨ¹ýÉÏÊöʵÀý¿ÉÖª£¬thinkphp¿ÉÒÔͨ¹ý¶àÖÖ·½·¨À´ÊµÏÖ²î±ðÄ £¿éÖ®¼äµÄÅþÁ¬£¬°üÀ¨URLÅþÁ¬¡¢¿ØÖÆÆ÷ÅþÁ¬ºÍ²Ù×÷ÒªÁìÅþÁ¬¡ £¿ª·¢Õß¿ÉÒÔƾ֤ÏêϸµÄÐèÇóºÍÇéÐΣ¬Ñ¡ÔñºÏÊʵķ½·¨À´¾ÙÐÐÅþÁ¬¡£Í¬Ê±£¬ÔÚʹÓÃthinkphp¾ÙÐÐÏîÄ¿¿ª·¢Ê±£¬»¹Òª×¢ÖØÕÆÎÕÆäËüµÄÒªÁìºÍ¼¼ÇÉ£¬ÒÔ±ãÄܹ»¸üºÃµØʹÓÃËüÀ´ÊµÏÖ¿ª·¢Ä¿µÄ¡£

ÒÔÉϾÍÊÇthinkphpʵÏÖ²î±ðÄ £¿éµÄÅþÁ¬µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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