我建立一個迷你型的CMS,但是當我嘗試使用會話我得到這個錯誤:PHP會話功能說棄用
推薦使用:功能session_is_registered()在index.php文件已經過時上線4條,其中,我使用的代碼是:
<?php
session_start(); //Start the session
define(ADMIN,$_SESSION['name']); //Get the user name from the previously registered super global variable
if(!session_is_registered("admin")){ //If session not registered
header("location:login.php"); // Redirect to login.php page
}
else //Continue to current page
header('Content-Type: text/html; charset=utf-8');
?>
它還說一些關於已經發出頭......
[用於棄用session_is_registered替代]的可能重複(http://stackoverflow.com/questions/5286446/alternative-for-deprecated-session-已註冊) – ManseUK
只需要一個[Google搜索](http://www.google.com/search?q=session_is_registered()+替代)即可找到[解決方案](http://stackoverflow.com/questions/) 2600905/PHP-替代到會話被登記)。所以。可能重複以及 – Havelock