為什麼我用session在國外PHP空間會出現錯誤呢?

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

在家裡的PHP就沒問題

但是在國外的就會出現這錯誤訊息

line 0是

<?

session_start();

session_register("checked");

?>

網站是這個www.000webhost.com

有用過這空間或是知道原因的大大可以幫幫忙嗎?

感恩

2 Answers

Rating
  • Terry
    Lv 5
    1 decade ago
    Favorite Answer

    試試把

    session_register("checked");

    改成

    $_SESSION["checked"] = "";

    如果你是要把 $checked 讀進SESSION的話

    改成

    $_SESSION["checked"] = $checked;

    session_register() 這個 function 是舊的

    在 PHP 5.3.0 以後的版本不建議使用

  • 1 decade ago

    does not consider global variables

Still have questions? Get your answers by asking now.