×ðÁú¿­Ê±

thinkphpÔõÑùת´ïGET²ÎÊý

ÔÚThinkPHPÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃURLµØµãÀ´×ª´ï²ÎÊý¡£ThinkPHP ¿ò¼Ü»á×Ô¶¯ÆÊÎö URL µØµãÖеIJÎÊý£¬²¢½«Æäת´ï¸øÏìÓ¦µÄ¿ØÖÆÆ÷ºÍÒªÁì¡£

ÀýÈ磬×ðÁú¿­Ê± URL µØµãΪ£ºhttp://localhost/index.php/Index/index?id=1&name=thinkphp£¬ÆäÖÐ id=1 ºÍ name=thinkphp ¼´Îª×ª´ïµÄ²ÎÊý¡£ÔÚ¿ØÖÆÆ÷ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓà $this->request->param() ÒªÁìÀ´»ñÈ¡ URL µØµãÖÐת´ïµÄ²ÎÊý¡£ÀýÈ磺

public function index()
{
    $id = $this->request->param('id');
    $name = $this->request->param('name');
    echo 'ID=' . $id . ', Name=' . $name;
}

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÕâÑù£¬µ±ÎÒÃÇ»á¼ûÉÏÊöµÄ URL µØµãʱ£¬¿ØÖÆÆ÷»áÊä³ö£ºID=1, Name=thinkphp¡£

³ýÁË URL µØµãת´ï²ÎÊýÍ⣬ÎÒÃÇÒ²¿ÉÒÔʹÓÃ±íµ¥À´×ª´ï²ÎÊý¡£ÔÚ HTML ±íµ¥ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓà name ÊôÐÔÀ´±êʶÐèҪת´ïµÄ²ÎÊý£¬¶øÔÚ¿ØÖÆÆ÷ÖÐͬÑù¿ÉÒÔʹÓà $this->request->param() ÒªÁìÀ´»ñÈ¡±íµ¥ÖÐת´ïµÄ²ÎÊý¡£

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

ÀýÈ磬ÔÚ HTML ±íµ¥ÖУ¬ÎÒÃÇÐèҪת´ï id ºÍ name ²ÎÊý¡£Ôò¿ÉÒÔÕâÑù±àд HTML ´úÂ룺

<form action="/index.php/Index/index" method="get">
    <input type="text" name="id" value="1">
    <input type="text" name="name" value="thinkphp">
    <input type="submit" value="Ìá½»">
</form>

µÇ¼ºó¸´ÖÆ

ÔÚ¿ØÖÆÆ÷ÖУ¬ÎÒÃÇͬÑù¿ÉÒÔʹÓà $this->request->param() ÒªÁìÀ´»ñÈ¡±íµ¥ÖÐת´ïµÄ²ÎÊý¡£ÀýÈ磺

public function index()
{
    $id = $this->request->param('id');
    $name = $this->request->param('name');
    echo 'ID=' . $id . ', Name=' . $name;
}

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÕâÑù£¬µ±ÎÒÃÇÌá½»±íµ¥ºó£¬¿ØÖÆÆ÷ͬÑù»áÊä³ö£ºID=1, Name=thinkphp¡£

ÒÔÉϾÍÊÇthinkphpÔõÑùת´ïGET²ÎÊýµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

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