×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÔõôÅжÏÇëÇó·½·¨

thinkphpÊÇÒ»¸öÓÅÒìµÄphp¿ò¼Ü£¬ËüÌṩÁ˸»ºñµÄº¯ÊýºÍÒªÁìÀ´×ÊÖú¿ª·¢ÕßʵÏÖÖÖÖÖ¹¦Ð§¡£ÆäÖУ¬ÅжÏÇëÇó·½·¨ÊÇweb¿ª·¢ÖзǾ­³£¼ûµÄ¹¦Ð§Ö®Ò»¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÏÈÈÝÔõÑùʹÓÃthinkphpÀ´ÅжÏhttpÇëÇó·½·¨¡£

HTTPÇëÇó·½·¨¸ÅÊö

ÔÚHTTPЭÒéÖУ¬ÇëÇó·½·¨£¨Request Method£©´ú±í¿Í»§¶Ë£¨Í¨³£ÊÇWebä¯ÀÀÆ÷£©Ï£ÍûЧÀÍÆ÷Ö´ÐеÄÐж¯¡£HTTPЭÒéÏÖÔÚ½ç˵ÁË8ÖÖÇëÇó·½·¨£¬»®·ÖÊÇ£º

GET£ºÏòЧÀÍÆ÷ÇëÇóÒ»¸ö×ÊÔ´£¬Ð§ÀÍÆ÷·µ»Ø¸Ã×ÊÔ´£»

POST£ºÌá½»Êý¾Ýµ½Ð§ÀÍÆ÷£¬Ð§ÀÍÆ÷´¦Àí¸ÃÊý¾Ý£»

PUT£º¸üÐÂЧÀÍÆ÷ÉϵÄ×ÊÔ´£»

DELETE£ºÉ¾³ýЧÀÍÆ÷ÉϵÄ×ÊÔ´£»

HEAD£º»ñȡЧÀÍÆ÷¶Ô×ÊÔ´µÄÏìӦͷÐÅÏ¢£¬¶ø²»·µ»Ø×ÊÔ´µÄʵÌåÄÚÈÝ£»

OPTIONS£ºÅÌÎÊЧÀÍÆ÷Õë¶Ô×ÊÔ´Ö§³ÖµÄÇëÇó·½·¨£»

CONNECT£º½¨ÉèÍøÂçÅþÁ¬ËíµÀ£¬ÓÃÓÚÊðÀíЧÀÍÆ÷£»

TRACE£º×·×ÙЧÀÍÆ÷Ö®¼äµÄͨѶ·¾¶¡£

ÆäÖУ¬GETºÍPOSTÇëÇó·½·¨ÊÇ×î³£ÓõÄ¡£

ThinkPHPÖÐÅжÏÇëÇó·½·¨µÄÒªÁì

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

ÔÚThinkPHP¿ò¼ÜÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃRequest¹¤¾ßÌṩµÄÒªÁìÀ´ÅжÏÄ¿½ñµÄHTTPÇëÇó·½·¨¡£Request¹¤¾ßÊÇϵͳ¼¶±ðµÄÀ࣬ÎÒÃÇ¿ÉÒÔͨ¹ýŲÓøù¤¾ßÌṩµÄÒªÁìÀ´²Ù×÷Ä¿½ñHTTPÇëÇó¡£ÒÔÏÂÊÇһЩ³£ÓõÄÅжÏHTTPÇëÇó·½·¨µÄÒªÁ죺

isPost()

¸ÃÒªÁìÓÃÓÚÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó¡£ÈôÊÇÄ¿½ñÇëÇóÊÇPOSTÇëÇó£¬Ôò·µ»Øtrue£¬²»È»·µ»Øfalse¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

if (Request::isPost()) {
    // do something...
}

µÇ¼ºó¸´ÖÆ

isGet()

¸ÃÒªÁìÓÃÓÚÅжÏÄ¿½ñÇëÇóÊÇ·ñΪGETÇëÇó¡£ÈôÊÇÄ¿½ñÇëÇóÊÇGETÇëÇó£¬Ôò·µ»Øtrue£¬²»È»·µ»Øfalse¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

if (Request::isGet()) {
    // do something...
}

µÇ¼ºó¸´ÖÆ

isPut()

¸ÃÒªÁìÓÃÓÚÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPUTÇëÇó¡£ÈôÊÇÄ¿½ñÇëÇóÊÇPUTÇëÇó£¬Ôò·µ»Øtrue£¬²»È»·µ»Øfalse¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

if (Request::isPut()) {
    // do something...
}

µÇ¼ºó¸´ÖÆ

isDelete()

¸ÃÒªÁìÓÃÓÚÅжÏÄ¿½ñÇëÇóÊÇ·ñΪDELETEÇëÇó¡£ÈôÊÇÄ¿½ñÇëÇóÊÇDELETEÇëÇó£¬Ôò·µ»Øtrue£¬²»È»·µ»Øfalse¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

if (Request::isDelete()) {
    // do something...
}

µÇ¼ºó¸´ÖÆ

isAjax()

¸ÃÒªÁìÓÃÓÚÅжÏÄ¿½ñÇëÇóÊÇ·ñΪAjaxÇëÇó¡£ÈôÊÇÄ¿½ñÇëÇóÊÇAjaxÇëÇó£¬Ôò·µ»Øtrue£¬²»È»·µ»Øfalse¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

if (Request::isAjax()) {
    // do something...
}

µÇ¼ºó¸´ÖÆ

method()

¸ÃÒªÁìÓÃÓÚ»ñÈ¡Ä¿½ñµÄHTTPÇëÇó·½·¨¡£ÒªÁì·µ»ØµÄЧ¹ûȫΪ´óд×Öĸ¡£Ê¾Àý´úÂëÈçÏ£º

use think\facade\Request;

$method = Request::method();

if ($method == 'GET') {
    // do something...
} elseif ($method == 'POST') {
    // do something...
}

µÇ¼ºó¸´ÖÆ

×ÛÉÏËùÊö£¬ÎÒÃÇÔÚʹÓÃThinkPHP¿ª·¢Ê±£¬¿ÉÒÔʹÓÃRequest¹¤¾ßÌṩµÄÒªÁìÇáËÉÅжÏÄ¿½ñÇëÇóµÄHTTPÇëÇó·½·¨£¬²¢Æ¾Ö¤ÅжÏЧ¹ûÖ´Ðвî±ðµÄÓªÒµÂß¼­¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

13452372176

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

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

QR code
ÍøÕ¾µØͼ