after request sample/one and I’m hoping that sample/two get data from the session but the session data is empty
even session_start(); is declared please help me out or any suggestion
$app->post(’/sample/one’, function (Request $request, Response $response, $args) {
When you use Symfony Session then you have to invoke $session->start(); method. When you use the native PHP $_SESSION variable you have to call the session_start(); function for each request.
This behavior also depends on the cookie settings and the browser.
In most cases, cookies are valid on a domain and all subdomains.
If the domain name in your cookie’s domain parameter doesn’t start with a period, then it will not let subdomains read that cookie. If it does start with the period, then all subdomains will have full access to that cookie’s value.
Generally it’s better to operate only in one domain when working with cookies (and ajax).