POST without Form Method (PHP)

前端 未结 7 1805
囚心锁ツ
囚心锁ツ 2021-02-13 15:24

Is there any way to pass stuff from one page to another using the POST method without using forms.

Like in get you can just append a ? with whatever you wan

7条回答
  •  Happy的楠姐
    2021-02-13 16:02

    Just use sessions.

    The storage of sessions in a cookie is as indicated by the answers above limited to the ID of the session. Cookies can even be configured to be sent as HTTP-cookies only, if you're security-minded.

    On the requesting page, set the session key-value pair you want. On the requested page request the previously set session key (check if it exists first). In you're php.ini you can choose to use session cookies as HTTP-only so you have more security.

    Furthermore: posting data can be as simple as using AJAX or cURL as described above also.

提交回复
热议问题