Home  >  Article  >  Backend Development  >  PHP simply implements single sign-on

PHP simply implements single sign-on

不言
不言Original
2018-06-07 17:35:309771browse

这篇文章主要介绍了PHP简单实现单点登录功能,结合实例形式分析了php基于session控制实现单点登录的相关操作技巧,需要的朋友可以参考下

本文实例讲述了PHP简单实现单点登录功能。分享给大家供大家参考,具体如下:

1.准备两个虚拟域名

127.0.0.1  www.openpoor.com
127.0.0.1  www.myspace.com

2.在openpoor的根目录下创建以下文件

index.PHP






sync login

hello,游客;请先登录进入空间 hello,;进入空间 home

login.php






sync login

sync.php









passport

3.在myspace的根目录下创建如下文件

slogin文件 完成session的设置

index.php

4.Des.php的文件内容如下

当在openpoor登录后将session信息传到其他域名下的文件下进行处理,以script标签包含的形式进行运行。

5.此时访问www.openpoor.com和www.myspace.com都是未登录状态

登录后两个域名下都是登录状态

到此我们实现了一个简单的单点登录。

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!

相关推荐:

thinkphp实现163、QQ邮箱收发邮件的方法

ThinkPHP实现简单登陆功能

The above is the detailed content of PHP simply implements single sign-on. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn