Pass variables between two PHP pages without using a form or the URL of page

后端 未结 5 1789
情深已故
情深已故 2020-12-04 22:27

I want to pass a couple of variables from one PHP page to another. I am not using a form. The variables are some messages that the target page will display if something goes

5条回答
  •  醉酒成梦
    2020-12-04 23:26

    Here are brief list:

    • JQuery with JSON stuff. (http://www.w3schools.com/xml/xml_http.asp)

    • $_SESSION - probably best way

    • Custom cookie - will not *always* work.

    • HTTP headers - some proxy can block it.

    • database such MySQL, Postgres or something else such Redis or Memcached (e.g. similar to home-made session, "locked" by IP address)

    • APC - similar to database, will not *always* work.

    • HTTP_REFERRER

    • URL hash parameter , e.g. http://domain.com/page.php#param - you will need some JavaScript to collect the hash. - gmail heavy use this.

提交回复
热议问题