2012-06-11 53 views
-1

Deprecated: Function session_is_registered() is deprecated in /home/socia125/public_html/logout.php on line 37不推薦使用:功能session_is_registered() - 如何解決這個錯誤

Warning: Cannot modify header information - headers already sent by (output started at /home/socia125/public_html/logout.php:37) in /home/socia125/public_html/logout.php on line 38

這裏的任何想法是代碼我使用

<?php 

session_start(); 
// Force script errors and warnings to show on page in case php.ini file is set to not  
display then 
error_reporting(E_ALL); 
ini_set('display_errors', '1'); 

// Unset all of the session variables 
$_SESSION = array(); 
// If it's desired to kill the session, also delete the session cookie 
if (isset($_COOKIE['idCookie'])) { 
setcookie("idCookie", '', time()-42000, '/'); 
setcookie("passCookie", '', time()-42000, '/'); 
} 
// Destroy the session variables 
session_destroy(); 
// Check to see if their session is in fact destroyed 
if(!session_is_registered('firstname')){ 
header("location: index.php"); // << makes the script send them to any page we set 
} else { 
print "<h2>Could not log you out, sorry the system encountered an error.</h2>"; 
    exit(); 
    } 
    ?> 
+0

這個問題是重複的。還有一個在這裏:http://stackoverflow.com/questions/2600905/php-alternative-to-session-is-registered – ceekays

+0

感謝好友我看着它 –

回答

2

只是檢查,看看如果會話變量被設置:

if(!session_is_registered('firstname')){ 

成爲

if (!isset($_SESSION['firstname'])) { 
+0

解析錯誤:語法錯誤,意想不到的'}'在/ home第39行的/socia125/public_html/logout.php有兩個不同的例子,語法錯誤相同。我是新來的,所以我不確定如何修復 –

+0

它只是缺少一個'{' –

+0

好吧,我想我把它複製錯了謝謝你兄弟 –

相關問題