Setting POST variable without using form

前端 未结 4 1412

Is there a way to set a $_POST[\'var\'] without using form related field (no type=\'hidden\') and using only PHP. Something like

$_POST[\'name\'         


        
4条回答
  •  感动是毒
    2020-12-01 14:20

    you can do it using ajax or by sending http headers+content like:

    POST /xyz.php HTTP/1.1
    Host: www.mysite.com
    User-Agent: Mozilla/4.0
    Content-Length: 27
    Content-Type: application/x-www-form-urlencoded
    
    userid=joe&password=guessme
    

提交回复
热议问题