Set php session via ajax

前端 未结 3 1861
心在旅途
心在旅途 2020-12-17 01:07

I\'m trying to build my AJAX login system but I\'m having some problems with PHP sessions.

This is the AJAX code I use in my index.php:

         


        
3条回答
  •  無奈伤痛
    2020-12-17 01:47

    Better check if session_start() is present in home.php. Without this you will not be able to read the session data.

    When you are doing echo $_SESSION['UserID'] = $UserID; you will assigning and accessing at a same line, so it will obviously work.

提交回复
热议问题