我對PHP相當陌生,並且確信這很簡單,但我希望以正確的方式進行操作。我有這個腳本:PHP會話副作用警告 - 如何得到解決?
<?php
if ($_POST["username"]=="") {
include($_SERVER['DOCUMENT_ROOT'] ."/login.inc.php");
} else {
$username=$_POST["username"];
$password=$_POST["password"];
session_start();
if ($username=="bob" AND $password=="123"){ $permission="yes";}
$username=$_POST["username"];
session_register("permission");
session_register("username");
if ($permission=="yes"){
// Show stuff
}
}
?>
打擾我的代碼時髦的格式 - 似乎無法讓它顯示正常。
所以,我不斷收到此錯誤:
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
這我假設意味着我需要改變我的變量名中的一個,它不會與會話變量相抵觸?這就是我讀的,但我不確定要改變哪一個。
任何人都可以幫忙/請給我看看嗎?
感謝
OSU
感謝您的答覆傢伙,大加讚賞 – Osu 2011-01-07 18:14:03