How to pass value JavaScript variable to PHP?

后端 未结 4 1158
借酒劲吻你
借酒劲吻你 2021-01-22 13:38

Passing value JavaScript variable to PHP.

Example

JavaScript

Var ffffd=\'aaaa\'

PHP

<         


        
4条回答
  •  鱼传尺愫
    2021-01-22 14:23

    One way you can do that is to put it in the cookie:

    var ffffd = 'aaaa';
    document.cookie = "ffffd="+ffffd; // the ffffd in the "" is the name of the cookie
    

    PHP

    $ffffd = $_COOKIE['ffffd'];
    if (ffffd == "aaa") { do something... }
    

提交回复
热议问题