dsjklb0205 2014-09-29 05:57
浏览 15
已采纳

我们可以POST来自url的值

I want to POST values coming from a url .

My url is xxx.com/aa.php?name=RAM

On aa.php page I have written like this

<?php $NAME=$_POST["name"]; ?>

but its value is getting null .

but when using GET Method its values is getting as 'RAM'.

How can I retrieve values using POST from a url ? or is it not possible?

  • 写回答

5条回答 默认 最新

  • dongsheng1238 2014-09-29 06:01
    关注

    When the parameter is in the URL it is a GET parameter.
    You can not fetch a GET parameter from the $_POST array, but the $_GET array.
    You can also use the $_REQUEST Array to get both POST and GET variables.

    In your case, the GET variable with the key name is RAM, as it should be.


    edit:
    Worth to mention is that the $_REQUEST array pretty much is a concatenation of $_POST, $_GET and $_COOKIE, so it might behave unexpected if any of the others (than the one you are after) are using the same key names.
    I would recommend using the type you are actually wanting, in this case, the $_GET list.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)