Home > Backend Development > PHP Tutorial > 同一个程序里 二个顶级域名如果共享COOKIE

同一个程序里 二个顶级域名如果共享COOKIE

WBOY
Release: 2016-06-13 12:54:23
Original
885 people have browsed it

同一个程序里 2个顶级域名如果共享COOKIE

本帖最后由 liaohongchu 于 2013-01-22 17:22:59 编辑 比如:www.xinqq163.com   tm.xinqq163.com  

但tm.xinqq163.com 变成 www.tm.com 单独的域名访问。 

但就无法共享COOKIE ,怎么样写才能访问呢?

原来的
www.xinqq163.com  tm.xinqq163.com是可以共享COOKIE的 代码如下:

$cfg_domain_cookie=".xinqq163.com";
function PutCookie($key, $value, $kptime=0, $pa="/")
    {
        global $cfg_cookie_encode,$cfg_domain_cookie;
        setcookie($key, $value, time()+$kptime, $pa,$cfg_domain_cookie);
        setcookie($key.'__ckMd5', substr(md5($cfg_cookie_encode.$value),0,16), time()+$kptime, $pa,$cfg_domain_cookie);


    }

------解决方案--------------------
好资源吐血推荐:http://download.csdn.net/detail/shw340518/5019519
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template