Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

How can React read a session SET in PHP

I suggest using cookies instead if security isn't an issue or else try something like this:

session.php

<?php session_start(); echo json_encode($_SESSION); ?>



code.js

fetch('session.php', {credentials: "same-origin"})
  .then(response => response.json())
  .then(data => console.log(data));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #React #read #session #SET #PHP
ADD COMMENT
Topic
Name
3+6 =