Home > Article > Backend Development > PHP SESSION失效有关问题 !
PHP SESSION失效问题 !!!
用CI写的腾讯登陆,需要存贮openId以及accessToken,
用Ajax
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } if(QC.Login.check())/*QQ 登录*/ { QC.Login.getMe(function(openId, accessToken){ xmlhttp.open("GET","http://localhost/CI/index.php/SaveInfo/save_qq_openId?openId="+openId+"&accessToken="+accessToken,true); xmlhttp.send(); }); }
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php session_id('openId');session_start();?>