在PHP中SESSION是保存在服务器端的文件,session文件的路径可在php.ini文件中找到,以xampp为例:C:/xampp/tmp。经常用变量$_SESSION来储存临时信息,如用$_SESSION['cart']来临时存储传递购物车信息,在应用此变量的时候,最好直接用$_SESSION['cart']作为引用 ,若另指定变量名称($cart=$_SESSION['cart']),容易在变量的传递过程中出现怪异的问题。
Note : This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do global $variable; to access it within functions or methods.