Pergunta

I have a static variable defined in some file called lastitems.php.

lastitems.php gets called every 5 seconds by a javascript function update_items().

But because lastitems.php is totally another file, then the static variable is redefined every time the file gets opened.

Is there a way to avoid redefining (re-initiating) the variable?

Foi útil?

Solução

lastitems.php

session_start();
$_SESSION['var'] = 'something';
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top