Use PHP sessions with jquery

后端 未结 7 1427
我寻月下人不归
我寻月下人不归 2021-01-26 10:02

Well, my question is simple:

I wish to use my PHP sessions in jQuery, in an if statement, however I do not know how I can do this on an easy way. Am I supposed to someho

相关标签:
7条回答
  • 2021-01-26 10:36

    Sadly that you can mix server-side script (PHP) with client-side script (Javascript). However, you can use PHP to echo Javascript, like:

    if ($admin == true || gebr_id == $_SESSION['id']){
        echo '<script>
                   alert("Admin!");
                   $("selector").function(); //
              </script>';
    }
    
    0 讨论(0)
提交回复
热议问题