douan6931 2018-10-23 16:05
浏览 39

我正在使用PHP API后端构建一个react web应用程序。 但是SESSION没有得到维护

I have written a react app with a PHP backend. I have a login area and have got this working great. This then redirects the user to another part of my app. So far so good.

But I was relying on the app maintaining session to check the user has permission to certain apis etc.

so this is how I am setting the session when user logs in

if( $passwordconfirm ){
   $_SESSION["sitekey"]["adminuser"]["id"] = $u->id // loaded user id
} 

Then when checking to load another resource

if( isset( $_SESSION["sitekey"]["adminuser"]["id"] ) ){ // never passes this
  return array( "data" => $pages );
}  

It seems every fetch request I make creates a new session, I can confirm this as output session ids and every single one was different. Any reason for this or way I can get around this?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发