douhuan1380 2018-03-31 20:18
浏览 98

在php页面上反应app; React无权访问Session

I've created a React App to my existing php page which is using session to store userid. The session is set by a normal .php login page, but when I try to call API call who access the session, it appears it's not set.

Is react apps inside its own 'environment' and is it required to use tokens?

I'm confused..

EDIT: solved it by this questin from om a different thread: https://stackoverflow.com/a/44111668/3010171

  • 写回答

1条回答 默认 最新

  • doulan9419 2018-03-31 23:25
    关注

    It's two different things. PHP works on server-side and React is client-side.

    enter image description here

    As you can see, WebServer returns a HTML content to a Client. ReactJS works in web browser. If you want to receive some datas from server, you can see this tutorial https://www.youtube.com/watch?v=Y4NHqDp88lA

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记