×ðÁú¿­Ê±

thinkphp5ÅжÏÊÇ·ñÊÇpostÇëÇó

ÔÚʹÓÃthinkphp5¾ÙÐÐweb¿ª·¢Ê± £¬ÅжÏÄ¿½ñÇëÇóÊÇ·ñΪpostÇëÇóÊÇÒ»ÖÖ³£¼ûµÄÐèÇó¡£ÓÉÓÚpostÇëÇóÓëgetÇëÇó²î±ð £¬postÇëÇóͨ³£ÓÃÓÚÏòЧÀÍÆ÷Ìá½»Êý¾Ý £¬¶øgetÇëÇóͨ³£ÓÃÓÚ´ÓЧÀÍÆ÷»ñÈ¡Êý¾Ý¡£Òò´Ë £¬ÔÚÇø·ÖÇëÇóÀàÐÍʱ £¬»á¶Ô¶ÔÓ¦µÄÇëÇó×ö³ö²î±ðµÄ´¦Öóͷ£¡£

ÔÚThinkPHP5ÖÐ £¬ÅжÏÄ¿½ñµÄÇëÇóÊÇ·ñΪPOSTÇëÇóºÜÊǼòÆÓ¡£ÏÂÃæÏÈÈÝÈýÖÖÒªÁìÀ´ÅжÏÊÇ·ñΪPOSTÇëÇó¡£

ÒªÁìÒ»£ºÊ¹ÓÃrequest¹¤¾ß

ÔÚThinkPHP5ÖÐ £¬¿ÉÒÔͨ¹ýrequest¹¤¾ß»ñÈ¡Ä¿½ñÇëÇóµÄÏà¹ØÐÅÏ¢¡£Í¨¹ýÅжÏÄ¿½ñÇëÇóµÄ·½·¨ÊÇ·ñΪPOST £¬¼´¿ÉÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó £¬´úÂëÈçÏ£º

use thinkRequest;

$request = Request::instance();
if ($request->isPost()) {
    // ´¦Öóͷ£POSTÇëÇóµÄÂß¼­´úÂë
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖÐ £¬Ê×ÏÈʵÀý»¯ÁËRequestÀà £¬²¢»ñÈ¡Ä¿½ñµÄÇëÇóÐÅÏ¢¡£½Ó×ÅŲÓÃRequest¹¤¾ßµÄisPost()ÒªÁìÀ´ÅжÏÄ¿½ñÇëÇóµÄ·½·¨ÊÇ·ñΪPOST¡£ÈôÊÇÊÇPOSTÇëÇó £¬ÔòÖ´ÐÐÏà¹ØµÄÓªÒµÂß¼­¡£

ÒªÁì¶þ£ºÊ¹ÓÃinput¹¤¾ß

ÔÚThinkPHP5µÄ¿ØÖÆÆ÷ÖÐ £¬¿ÉÒÔͨ¹ýinput¹¤¾ß»ñÈ¡Ä¿½ñÇëÇóµÄÏà¹ØÐÅÏ¢¡£Í¨¹ýÅжÏÄ¿½ñÇëÇóµÄ·½·¨ÊÇ·ñΪPOST £¬¼´¿ÉÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó £¬´úÂëÈçÏ£º

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

use thinkController;

class Index extends Controller
{
    public function index()
    {
        $request = $this->request->param();
        if ($this->request->isPost()) {
            // ´¦Öóͷ£POSTÇëÇóµÄÂß¼­´úÂë
        }
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖÐ £¬input¹¤¾ßÒ²±»ÓÃÀ´»ñÈ¡Ä¿½ñÇëÇóµÄÐÅÏ¢¡£Í¨¹ýÇëÇ󹤾ߵÄisPost()ÒªÁì £¬Ò²¿ÉÒÔÅжÏÄ¿½ñÇëÇóÊÇPOSTÇëÇóÕÕ¾ÉÆäËûÀàÐ͵ÄÇëÇó¡£

ÒªÁìÈý£ºÊ¹ÓÃrequestÖúÊÖº¯Êý

ÔÚThinkPHP5ÖÐ £¬»¹ÌṩÁËÒ»ÖÖÔ½·¢ÇáÓ¯µÄÒªÁìÀ´ÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó¡ £¿ÉÒÔʹÓÃrequestÖúÊÖº¯Êý £¬´úÂëÈçÏ£º

if (request()->isPost()) {
    // ´¦Öóͷ£POSTÇëÇóµÄÂß¼­´úÂë
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖÐ £¬Í¨¹ýŲÓÃrequest()ÒªÁì»ñÈ¡Ä¿½ñÇëÇóµÄÐÅÏ¢ £¬²¢Ö±½ÓʹÓÃrequest()º¯ÊýµÄisPost()ÒªÁìÀ´ÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó¡£

ÎÞÂÛÊÇʹÓÃrequest¹¤¾ß¡¢input¹¤¾ßÕÕ¾ÉrequestÖúÊÖº¯Êý £¬¶¼¿ÉÒÔºÜÈÝÒ×µØÅжÏÄ¿½ñÇëÇóÊÇ·ñΪPOSTÇëÇó¡£ÔÚ¿ª·¢Àú³ÌÖÐ £¬¿ÉÒÔƾ֤ÏêϸÐèÇóÑ¡ÔñʹÓòî±ðµÄ·½·¨¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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