Ïê½âthinkphpÊÇ·ñ¿ÉÒÔÎüÊÕGET²ÎÊý
thinkphpÊÇÒ»¿î»ùÓÚphpÓïÑԵĿªÔ´webÓ¦Óÿò¼Ü£¬ËüÌṩÁËÇ¿Ê¢µÄmvc¼Ü¹¹£¬¸»ºñµÄ¹¦Ð§Ä£¿éºÍÇ¿Ê¢µÄÀ©Õ¹ÐÔ¡£ÔÚ¿ª·¢webÓ¦ÓÃÀú³ÌÖУ¬¾³£ÐèÒªÎüÊÕget»òpost²ÎÊý£¬ÄÇôthinkphpÊÇ·ñ¿ÉÒÔÎüÊÕget²ÎÊýÄØ£¿±¾ÎĽ«Ïêϸ½â´ðÕâ¸öÎÊÌâ¡£
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÃ÷È·Ò»ÏÂGETÓëPOSTÇëÇóµÄÇø±ð¡£GETÇëÇóÊÇͨ¹ýURLת´ï²ÎÊý£¬²ÎÊýÐÅÏ¢¿ÉÒÔÖ±½Ó̻¶ÔڵصãÀ¸ÖУ¬¶øPOSTÇëÇóÔòÊÇͨ¹ýHTTP±¨ÎÄת´ï²ÎÊý£¬²ÎÊýÐÅÏ¢Ôò±»°üÀ¨ÔÚ±¨ÎĵÄÖ÷Ì岿·Ö£¬²»»áÖ±½Ó̻¶ÔڵصãÀ¸ÖС£
ÔÚthinkphp¿ò¼ÜÖУ¬ÎüÊÕGET²ÎÊýºÜÊǼòÆÓ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÖ±½ÓŲÓÃRequest¹¤¾ßµÄgetÒªÁìÀ´»ñÈ¡Ö¸¶¨²ÎÊýÖµ¡£ÀýÈ磺
$value = Request::get('param_name');
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬param_nameΪÎÒÃÇÖ¸¶¨µÄ²ÎÊýÃû¡£
±ðµÄ£¬»¹¿ÉÒÔͨ¹ýŲÓÃinputÒªÁìͬʱ»ñÈ¡POSTºÍGET²ÎÊý¡£ÀýÈ磺
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
$value = Request::input('param_name');
µÇ¼ºó¸´ÖÆ
´Ëʱ£¬ÈôÊÇͬʱ±£´æͬÃûµÄGETºÍPOST²ÎÊý£¬»áÓÅÏÈ»ñÈ¡POST²ÎÊý£¬ÈôÊDz»±£´æPOST²ÎÊý£¬Ôò»ñÈ¡GET²ÎÊý¡£
³ý´ËÖ®Í⣬»¹¿ÉÒÔͨ¹ýRequest¹¤¾ßµÄparamÒªÁìÀ´»ñÈ¡²ÎÊý¡£ÀýÈ磺
$value = Request::param('param_name');
µÇ¼ºó¸´ÖÆ
´ËÒªÁì¿ÉÒÔͬʱ»ñÈ¡POSTºÍGET²ÎÊý£¬ÓëinputÒªÁìÀàËÆ¡£µ«ÓëinputÒªÁì²î±ðµÄÊÇ£¬paramÒªÁ컹¿ÉÒÔÎüÊÕÒ»¸öĬÈÏÖµ×÷Ϊ²ÎÊý£¬µ±Ö¸¶¨²ÎÊý²»±£´æʱ£¬½«·µ»ØĬÈÏÖµ¡£ÀýÈ磺
$value = Request::param('param_name', 'default_value');
µÇ¼ºó¸´ÖÆ
ÈôÊÇÖ¸¶¨²ÎÊý²»±£´æ£¬Ôò·µ»Ødefault_value×÷ΪĬÈÏÖµ¡£
ÖµµÃ×¢ÖصÄÊÇ£¬ÓÉÓÚGETÇëÇóµÄ²ÎÊýÊÇͨ¹ýURLת´ïµÄ£¬Òò´Ë±£´æ±»¸Ä¶¯µÄΣº¦¡£Òò´Ë£¬ÔÚ»ñÈ¡GET²ÎÊýʱ£¬Ó¦¸Ã¶Ô²ÎÊý¾ÙÐÐÑÏ¿á¹ýÂ˺ÍУÑ飬±ÜÃâ¶ñÒâ¹¥»÷»òÎó²Ù×÷Ôì³É²»ÐëÒªµÄÇå¾²ÎÊÌâ¡£
×ÛÉÏËùÊö£¬thinkphp¿ò¼Ü¿ÉÒÔÇáËɵØÎüÊÕGET²ÎÊý£¬¿ª·¢Ö°Ô±¿ÉÒÔÎÞаµØʹÓÃRequest¹¤¾ßµÄget¡¢input»òparamÒªÁì»ñÈ¡²ÎÊýÖµ¡£ËäÈ»£¬ÔÚʹÓÃÕâЩҪÁìʱ£¬ÎÒÃÇ»¹ÐèҪעÖØÊý¾ÝÇå¾²ºÍ´úÂë¹æ·¶µÈÎÊÌ⣬²Å»ª¿ª·¢³ö¸ßÖÊÁ¿¡¢Çå¾²¿É¿¿µÄwebÓ¦ÓóÌÐò¡£
ÒÔÉϾÍÊÇÏê½âthinkphpÊÇ·ñ¿ÉÒÔÎüÊÕGET²ÎÊýµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡