-1

I'm using a session variable to keep track of the current site language, three values are possible, 1. EN, 2. RU, 3. ES.

the session variable is set initially in the config file:

$_SESSION['lang'] = 'RU';

but inside my db class I cannot access the variable. My basic understanding is that variables stored in the $_SESSION array are accessible throughout the site. so what's the problem?

4

2 回答 2

0

在实例化类之前,您需要打开会话。例如:

session_start('NAME_MY_SESSION')
于 2013-08-16T02:21:28.980 回答
0

一定要session_start();在使用会话变量之前调用。

于 2013-08-16T02:04:05.110 回答