zoukankan      html  css  js  c++  java
  • ucenter 和 uchome的整合心得

    简介:这是ucenter 和 uchome的整合心得的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=343928' scrolling='no'>

    1.每一个应用都包含uc_client,拿uchome举例

    2.uchome登陆时访问source/do_login.php 的getpassport函数,getpassport通过uc_client 直接连ucenter的数据库,实现当前站点的登陆

    3.uchome然后调用$ucsynlogin = uc_user_synlogin($setarr['uid']);实现跨域登陆

    4.在uc_user_synlogin函数里再用uc_client/client.php的fsockopen去访问ucenter下的index.php默认超时15秒

    5.在ucenter下的index.php根据请求的model和action和appid请求control/user.php 的onsynlogin函数

    6.onsynlogin函数通过循环,对系统下的所有应用(在data/cache/setting.php)做JS调用如下
    $synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']." mce_src="'.$app['url'].'/api/uc.php?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']."&time=".$this->time, 'ENCODE', $app['authkey'])).'"></script>';

    7.返回到uchome.在每个应用下的api目录有个uc.php文件查找$action == 'synlogin'下面是进行cookie设置
    obclean();
    header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
    这两行是必须的

    8.这样就在所有ucenter知道的应用下添加了cookie实现了跨域登陆

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/343928.html pageNo:5
  • 相关阅读:
    Arduino-原理图标识
    python-垃圾回收机制
    利用浮力测密度
    sys模块-与python解释器交互的模块
    第十一章第二节 功率
    第十一章第一节 功
    类-描述器-把类对象方法转变为属性方式
    H5浏览器播放RTMP直播流
    如何查看某个端口被谁占用
    OBS第三方推流直播教程
  • 原文地址:https://www.cnblogs.com/ooooo/p/2241962.html
Copyright © 2011-2022 走看看