通过 ini_set("session.cookie_domain",'test.com');
session_start();
来设置
单点登录:名词,指a网站登录后,b网站同步登录
实际案例:百度搜索登录成功,百度网盘,百度等网站同步登录
实现步骤:
步骤1:修改hosts文件,增加两个域名解析到本机
image.png
步骤2:修改apache虚拟主机文件,增加两个站点 (注:修改后重启apache)
<VirtualHost _default_:80>
ServerName shop.php.com
DocumentRoot "E:\www2\shop"
<Directory "E:\www2\shop">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost _default_:80>
ServerName blog.php.com
DocumentRoot "E:\www2\blog"
<Directory "E:\www2\blog">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
复制shop和blog目录放到配置的虚拟主机中
image.png image.png
网友评论