to feel8(准备早起的鸟):您好,你说的后两种方法我都用过,都不行! 这里是[Session]部分的配置,请帮我看看:[Session] session.save_handler = files ; handler used to store/retrieve data session.save_path = C:\WINNT\temp ; argument passed to save_handler ; in the case of files, this is the ; path where data files are stored session.use_cookies = 1 ; whether to use cookies session.name = PHPSESSID ; name of the session ; is used as cookie name session.auto_start = 0 ; initialize session on request startup session.cookie_lifetime = 20 ; lifetime in seconds of cookie ; or if 0, until browser is restarted session.cookie_path = / ; the path the cookie is valid for session.cookie_domain = leo-lan ; the domain the cookie is valid for session.serialize_handler = php ; handler used to serialize data ; php is the standard serializer of PHP session.gc_probability = 1 ; percentual probability that the ; 'garbage collection' process is started ; on every session initialization session.gc_maxlifetime = 1440 ; after this number of seconds, stored ; data will be seen as 'garbage' and ; cleaned up by the gc process session.referer_check = ; check HTTP Referer to invalidate ; externally stored URLs containing ids session.entropy_length = 0 ; how many bytes to read from the file session.entropy_file = ; specified here to create the session id ; session.entropy_length = 16 ; session.entropy_file = /dev/urandom session.cache_limiter = nocache ; set to {nocache,private,public} to ; determine HTTP caching aspects session.cache_expire = 180 ; document expires after n minutes 多谢了!!
session_save_path("$root/$set[sessSavePath]");
if(function_exists(session_cache_limiter))
{
session_cache_limiter('nocache');
}2.修改php.ini中
session.save_path = c:\winnt\temp\ 3.在程序根目录建tmp文件夹
这里是[Session]部分的配置,请帮我看看:[Session]
session.save_handler = files ; handler used to store/retrieve data
session.save_path = C:\WINNT\temp ; argument passed to save_handler
; in the case of files, this is the
; path where data files are stored
session.use_cookies = 1 ; whether to use cookies
session.name = PHPSESSID
; name of the session
; is used as cookie name
session.auto_start = 0 ; initialize session on request startup
session.cookie_lifetime = 20 ; lifetime in seconds of cookie
; or if 0, until browser is restarted
session.cookie_path = / ; the path the cookie is valid for
session.cookie_domain = leo-lan ; the domain the cookie is valid for
session.serialize_handler = php ; handler used to serialize data
; php is the standard serializer of PHP
session.gc_probability = 1 ; percentual probability that the
; 'garbage collection' process is started
; on every session initialization
session.gc_maxlifetime = 1440 ; after this number of seconds, stored
; data will be seen as 'garbage' and
; cleaned up by the gc process
session.referer_check = ; check HTTP Referer to invalidate
; externally stored URLs containing ids
session.entropy_length = 0 ; how many bytes to read from the file
session.entropy_file = ; specified here to create the session id
; session.entropy_length = 16
; session.entropy_file = /dev/urandom
session.cache_limiter = nocache ; set to {nocache,private,public} to
; determine HTTP caching aspects
session.cache_expire = 180 ; document expires after n minutes
多谢了!!
更改完php.ini要重新启动Web服务器
session_start();
//session_register(admin);
//session_register(admin_name);
$_SESSION['admin'] = "admin";
echo $_SESSION['admin'];
?>
session_start();
$_SESSION['admin'] = "admin";
if(!$_SESSION['admin']){
echo "请刷新";
}else{
echo "admin name is:".$_SESSION['admin'];
}
?>