douxian4376 2014-04-01 18:51
浏览 86
已采纳

PHP中的$ _POST,$ _GET,$ _SESSION和$ _COOKIES是从页面到页面传递变量的唯一方法吗?

The question speaks for itself, but is there any other method?

Could you kindly share them even if those are the best practices?

  • 写回答

6条回答 默认 最新

  • dongzhu6900 2014-04-01 18:54
    关注

    Those are the most obvious ways to input information into a page. It is possible to parse the input from the url in another way than $_GET, but why would you.

    Also, you can use other methods. For instance, you could save information in a file or database and read it in the next page, although you might still need some information in a cookie or the url to identify which information to read (session id).

    So, while strictly the answer to your question is 'no', I want to say 'yes', these are the methods you will commonly use.

    If it's strictly about those global variables, then you've got the $_REQUEST variable, which basically collects all values from $_GET, $_POST and $_COOKIE together. And $_FILES gives information about uploaded files, which are automatically stored in a temporary location, although in essence, those files are also posted to the page. So, these globals help you making things easy regarding the most common methods to communicate with a script.

    All these are for input, by the way. You cannot send information back, or to the next page, by modifying these $_SUPERGLOBALS.

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

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错