سؤال

I am using 7digital API in a PHP project. Here is my code to calling API:

print_r($_SESSION);   

$requestUrl = "http://api.7digital.com/1.2/release/details?oauth_consumer_key=" . SEVEN_DIGITAL_CONSUMER_KEY . "&country=$CountryCode&releaseid=" . $wishlistArray[$i]['release7id'] . "&imageSize=33";
$response = simplexml_load_file($requestUrl);

print_r($_SESSION); 

It's working fine but here is a problem like:

If i press refresh button one time then session variable is not unsetting means (i can access session data after API calling code) but press again refresh button before loading previous refresh action then session data will be unset automatically.

Means if i press more than one time refresh button continuously then session data automatically destroyed.

What may be reason?

For one time refreshing it's working fine. If i removed XML loading code then it's working fine to more than one time refreshing or single time refreshing.

هل كانت مفيدة؟

المحلول

It's a fairly well-known problem/bug.

See here to get full a full explanation and complete solution.

نصائح أخرى

include session_start(); at the top of your script

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top