×ðÁú¿­Ê±

thinkphpÔõôÌá½»Êý¾Ý

ʹÓÃthinkphp¿ò¼Ü¾ÙÐпª·¢ £¬Ìá½»Êý¾ÝÊǷǾ­³£¼ûµÄ²Ù×÷  ¡£Ôڸÿò¼ÜÖÐ £¬Ìá½»Êý¾ÝµÄ·½·¨ÓжàÖÖ £¬ÏêϸÈçÏ£º

1. GET·½·¨Ìá½»Êý¾Ý

ʹÓÃGET·½·¨Ìá½»Êý¾Ý £¬¿ÉÒÔͨ¹ýURLµØµãת´ï²ÎÊý £¬¸Ã·½·¨ÊÊÓÃÓÚÉÙÁ¿µÄÊý¾Ý £¬ºÃ±ÈËÑË÷Òªº¦×Ö¡¢·ÖÒ³µÈ²Ù×÷  ¡£ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÒÔÏ·½·¨»ñÈ¡GET²ÎÊý£º

// »ñÈ¡µ¥¸öGET²ÎÊý
$param = input('get.param');

// »ñÈ¡ËùÓÐGET²ÎÊý
$params = input('get.');

µÇ¼ºó¸´ÖÆ

2. POST·½·¨Ìá½»Êý¾Ý

ʹÓÃPOST·½·¨Ìá½»Êý¾Ý £¬¿ÉÒÔÏòЧÀÍÆ÷·¢ËÍ´ó×ÚÊý¾Ý £¬ºÃ±È±íµ¥Êý¾Ý¡¢ÎļþÉÏ´«µÈ  ¡£ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÒÔÏ·½·¨»ñÈ¡POST²ÎÊý£º

// »ñÈ¡µ¥¸öPOST²ÎÊý
$param = input('post.param');

// »ñÈ¡ËùÓÐPOST²ÎÊý
$params = input('post.');

µÇ¼ºó¸´ÖÆ

3. JSON·½·¨Ìá½»Êý¾Ý

ʹÓÃJSON·½·¨Ìá½»Êý¾Ý £¬¿ÉÒÔÔÚÇ°ºó¶ËÊèÉ¢µÄ¿ª·¢ÖÐʹÓà £¬Í¨¹ýAJAXµÈ·½·¨½«JSONÊý¾ÝÃûÌ÷¢Ë͵½Ð§ÀÍÆ÷¶Ë  ¡£ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÒÔÏ·½·¨»ñÈ¡JSON²ÎÊý£º

// »ñÈ¡JSON²ÎÊý
$json = file_get_contents('php://input');
$params = json_decode($json, true);   // ½«JSON×Ö·û´®×ª»»³ÉÊý×é

µÇ¼ºó¸´ÖÆ

4. PUT·½·¨Ìá½»Êý¾Ý

ʹÓÃPUT·½·¨Ìá½»Êý¾Ý £¬¿ÉÒÔ¶ÔЧÀÍÆ÷ÉÏÒÑÓÐ×ÊÔ´¾ÙÐÐÐÞ¸Ä  ¡£ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÒÔÏ·½·¨»ñÈ¡PUT²ÎÊý£º

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

// »ñÈ¡PUT²ÎÊý
$put = file_get_contents("php://input");
parse_str($put, $params);   // ½«PUT²ÎÊýת»»³ÉÊý×é

µÇ¼ºó¸´ÖÆ

5. DELETE·½·¨Ìá½»Êý¾Ý

ʹÓÃDELETE·½·¨Ìá½»Êý¾Ý £¬¿ÉÒÔɾ³ýЧÀÍÆ÷ÉÏÒÑÓÐ×ÊÔ´  ¡£ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÒÔÏ·½·¨»ñÈ¡DELETE²ÎÊý£º

// »ñÈ¡DELETE²ÎÊý
$delete = $_SERVER['QUERY_STRING'];
parse_str($delete, $params);   // ½«DELETE²ÎÊýת»»³ÉÊý×é

µÇ¼ºó¸´ÖÆ

³ýÁËÒÔÉÏ5ÖÖ·½·¨ £¬ThinkPHP¿ò¼Ü»¹ÌṩÁËinput¹¤¾ß £¬¿ÉÒÔͨ¹ýÈçÏ·½·¨»ñÈ¡Ìá½»µÄÊý¾Ý£º

// »ñÈ¡All²ÎÊý£¨°üÀ¨GET¡¢POST¡¢JSON¡¢PUT¡¢DELETE£©
$params = input('param.');

µÇ¼ºó¸´ÖÆ

ÔÚThinkPHP¿ò¼ÜÖÐ £¬¿ÉÒÔƾ֤×Ô¼ºÏÖʵÐèÇóÑ¡ÔñºÏÊʵķ½·¨»ñÈ¡Ìá½»µÄÊý¾Ý  ¡£Í¬Ê± £¬ÐèҪעÖØÇå¾²ÐÔ £¬¹ØÓÚÓû§Ìá½»µÄÊý¾ÝÐèÒª¾ÙÐйýÂ˺ÍÑéÖ¤ £¬±ÜÃâ×¢ÈëºÍ¹¥»÷µÈ¶ñÒâÐÐΪ  ¡£

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

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

Ïà¹ØÐÂÎÅ

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

13452372176

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

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

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