getÊÇʲôÒâ˼
get ÊÇ http ÇëÇóÒªÁ죬ÓÃÓÚ´ÓЧÀÍÆ÷»ñÈ¡×ÊÔ´¡£ÆäÌصã°üÀ¨ÃݵÈÐÔ¡¢Çå¾²ÐÔ¡¢url ±àÂ룻Ö÷ÒªÓÃÓÚ¼ìË÷ÍøÒ³¡¢Í¼Ïñ¡¢ÊÓƵ¡¢¶ÁÈ¡ api Êý¾ÝºÍ±íµ¥Ìá½»µÈ¡£Ïà±È post£¬get ͨ¹ý url ·¢ËÍÊý¾Ý£¬¸üÇå¾²£¬µ« post ¸üÊʺÏÐÞ¸ÄЧÀÍÆ÷״̬µÄ²Ù×÷¡£
ʲôÊÇ GET
GET ÊÇ HTTP ÇëÇóÒªÁìµÄÒ»ÖÖ£¬ÓÃÓÚ´ÓЧÀÍÆ÷»ñÈ¡×ÊÔ´¡£ËüÊÇ×î»ù±¾µÄ HTTP ÒªÁ죬ÓÃÓÚ¼ìË÷ÍøÒ³¡¢Í¼Ïñ¡¢ÎĵµºÍÆäËûÊý¾Ý¡£
GET ÔõÑùÊÂÇé
µ±¿Í»§¶Ë·¢ËÍ GET ÇëÇóʱ£¬Ëü½«×ÊÔ´µÄ URL °üÀ¨ÔÚÇëÇóÖС£Ð§ÀÍÆ÷ÊÕµ½ÇëÇóºó£¬»á²éÕÒÇëÇóµÄ×ÊÔ´²¢½«Æä·µ»Ø¸ø¿Í»§¶Ë¡£ÒÔÏÂÊÇÒ»¸ö GET ÇëÇóµÄÒ»Ñùƽ³£ÃûÌãº
GET /uri HTTP/1.1 Host: example.com
µÇ¼ºó¸´ÖÆ
ÆäÖУº
/uri ÊÇÇëÇóµÄ×ÊÔ´µÄ·¾¶
HTTP/1.1 ÊÇ HTTP ÐÒé°æ±¾
Host: example.com Ö¸¶¨ÁËÇëÇóµÄÖ÷»ú
GET µÄÌصã
GET ÇëÇó¾ßÓÐÒÔÏÂÌص㣺
ÃݵÈÐÔ£º¶à´Î·¢ËÍÏàͬµÄ GET ÇëÇó²»»á¸Ä±äЧÀÍÆ÷µÄ״̬¡£
Çå¾²ÐÔ£ºGET ÇëÇó²»»áÐÞ¸ÄЧÀÍÆ÷ÉϵÄÊý¾Ý£¬Òò´Ëͨ³£±»ÒÔΪÊÇÇå¾²µÄ¡£
URL ±àÂ룺GET ÇëÇóÖеÄÊý¾ÝÒÔ URL ±àÂëµÄÐÎʽ·¢ËÍ£¬ÕâʹµÃËüÃÇ¿ÉÒÔ°üÀ¨ÌØÊâ×Ö·ûºÍÆäËû·Ç ASCII ×Ö·û¡£
GET µÄÓÃ;
GET ÇëÇóÆÕ±éÓÃÓÚÖÖÖÖÓ¦ÓÃÖУ¬°üÀ¨£º
¼ìË÷ÍøÒ³£ºGET ÇëÇóÓÃÓÚ´ÓЧÀÍÆ÷»ñÈ¡ÍøÒ³ÄÚÈÝ¡£
¼ÓÔØͼÏñºÍÊÓƵ£ºGET ÇëÇóÓÃÓÚ¼ÓÔØÍøÒ³ÖеÄͼÏñºÍÊÓƵ¡£
¶ÁÈ¡ API Êý¾Ý£ºGET ÇëÇóÓÃÓÚ´Ó API ЧÀÍÆ÷¶ÁÈ¡Êý¾Ý¡£
±íµ¥Ìá½»£ºGET ÇëÇóÓÐʱÓÃÓÚÌá½»±íµ¥Êý¾Ý£¬Ö»¹Ü POST ÒªÁì¸ü³£¼û¡£
GET Óë POST µÄÇø±ð
GET ºÍ POST ÊÇ×î³£ÓÃµÄ HTTP ÇëÇóÒªÁ죬µ«ËüÃÇÖ®¼ä±£´æһЩҪº¦Çø±ð£º
Êý¾Ýת´ï£ºGET ÇëÇó½«Êý¾Ýͨ¹ý URL ·¢ËÍ£¬¶ø POST ÇëÇó½«Êý¾Ýͨ¹ýÇëÇóÕýÎÄ·¢ËÍ¡£
Çå¾²ÐÔ£ºPOST ÇëÇó±È GET ÇëÇó¸üÇå¾²£¬ÓÉÓÚËü²»½«Êý¾Ý̻¶ÔÚ URL ÖС£
ÃݵÈÐÔ£ºPOST ÇëÇóͨ³£²»ÊÇÃݵȵģ¬ÓÉÓÚ¶à´Î·¢ËÍÏàͬµÄ POST ÇëÇó¿ÉÄÜ»áÐÞ¸ÄЧÀÍÆ÷µÄ״̬¡£
ÒÔÉϾÍÊÇgetÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡