![](/img/trans.png)
[英]Strange PHP Session behaviour. PHP overwrites $_SESSION['var'] with $var
[英]strange behaviour of php session
即時通訊使用php服務器,使用ubuntu 8.04:
PHP 5.2.4-2ubuntu5.12 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 20 2010 13:33:05)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
我發現了一個奇怪的行為:
<?php
session_name('session');
session_start();
$_SESSION['username']='realName';
$username='otherName';
?>
這導致php保存在會話變量“ otherName”(而不是“ realName”)中。 為什么PHP將$ username保存到會話變量中? 我如何禁用此功能?
預先感謝您的任何幫助... :)
看來您在php.ini中已register_globals = on
。 自PHP 5.3起不推薦使用此選項,您應該將其關閉。 可以在這里找到更多信息: http : //www.php.net/manual/en/security.globals.php
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.