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

1.准备两个虚拟域名

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

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

index.PHP

<"UTF-8"/>
<title>sync login</title>
</head>
<body>
<"login.php" rel="external nofollow" >登录</a><a href="http://www.myspace.com/index.php" rel="external nofollow" rel="external nofollow" >进入空间</a>
<"http://www.myspace.com/index.php" rel="external nofollow" rel="external nofollow" >进入空间</a>
<"http://www.openpoor.com/index.php" rel="external nofollow" >home</a>
</body>
</html>

login.php

<"UTF-8"/>
<title>sync login</title>
</head>
<body>
<form action="" method="post">
 <input type="text" name="username" placeholder="用户名"/>
 <input type="text" name="password" placeholder="密码"/>
 <input type="submit" value="登录"/>
</form>
</body>
</html>

sync.php

<"UTF-8"/>
<"text/javascript" src="/UploadFiles/2021-04-02/<">
<"CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
  $_SESSION['username'] = $username;
 }
}
"htmlcode">
<"欢迎来到".$_SESSION['username']."的空间";
}else{
  echo "请先登录";
}
"htmlcode">
<"\0");
   if($_data[0]!=md5($decrypted)){
  return false;
   }
   return $decrypted;
 }
}
"//img.jbzj.com/file_images/article/201803/2018320150006177.png" alt="" />

PHP简单实现单点登录功能示例

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

PHP简单实现单点登录功能示例

PHP简单实现单点登录功能示例

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

更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP+MySQL会员系统开发专题》、《PHP数据结构与算法教程》、《php程序设计算法总结》、《php字符串(string)用法总结》、《PHP数组(Array)操作技巧大全》、《PHP常用遍历算法与技巧总结》及《PHP数学运算技巧总结》

希望本文所述对大家PHP程序设计有所帮助。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。