Cookies in WeChat built-in browser it's weird.

Source: Internet
Author: User
Tags setcookie
Cookies in the built-in browser it's weird.
This is the code to set up and delete cookies

function set_cookie($var ,$value = '' ,$expire = 0){$path = '/';$domain = 'aaa.com';$auth = 'sadfsadfasdf';if($value!='') $value = _myencrypt($value ,$auth);$var = '__abc_'.$var;if($expire==0){    $expire = 0;}else if($expire > 0){    $expire = __TIME__ + (86400*$expire);}else{    $expire = $expire * 86400;}setcookie($var ,$value ,$expire ,$path,$domain);unset($var ,$expire ,$path ,$domain);}function delete_cookie($var){$path = '/';$domain = 'aaa.com';$expire = __TIME__ - 2592000;if(is_array($var)){    foreach($var as $val){        $var = '__abc_'.$val;        setcookie($var ,'' ,$expire , $path,$domain);    }}else{    setcookie('__abc_'.$var ,'' ,$expire , $path,$domain);}unset($path ,$expire ,$domain);}

It's not a problem in a normal browser.

But with the opening of this site, login no problem, but the exit is not, have been unable to delete cookies ...

Or a split-time, yesterday I remember can be again ...

Neither iOS nor Android.

Reply content:

Cookies in the built-in browser it's weird.
This is the code to set up and delete cookies

function set_cookie($var ,$value = '' ,$expire = 0){$path = '/';$domain = 'aaa.com';$auth = 'sadfsadfasdf';if($value!='') $value = _myencrypt($value ,$auth);$var = '__abc_'.$var;if($expire==0){    $expire = 0;}else if($expire > 0){    $expire = __TIME__ + (86400*$expire);}else{    $expire = $expire * 86400;}setcookie($var ,$value ,$expire ,$path,$domain);unset($var ,$expire ,$path ,$domain);}function delete_cookie($var){$path = '/';$domain = 'aaa.com';$expire = __TIME__ - 2592000;if(is_array($var)){    foreach($var as $val){        $var = '__abc_'.$val;        setcookie($var ,'' ,$expire , $path,$domain);    }}else{    setcookie('__abc_'.$var ,'' ,$expire , $path,$domain);}unset($path ,$expire ,$domain);}

It's not a problem in a normal browser.

But with the opening of this site, login no problem, but the exit is not, have been unable to delete cookies ...

Or a split-time, yesterday I remember can be again ...

Neither iOS nor Android.

The cookie is not persistent, and as far as I can test it, sometimes it is closed and then opened. The exact time saved in Android and IOS may vary.

Previously wanted to use a cookie to distinguish between unique users, and later found no. But there is no service number to do oauth authorization, really headache for a while. Later found this, solved my problem:
Gate of api:http://wgate.gaitianxia.com/

I also encountered the same problem, is not delete cookies, annoying!
But now found that his cell phone will be like this, the others will not, my phone parameters:
Lt22i
Android 4.1.2 (Kernel 3.0.8+)
Version 6.2.4

And the cookie can also be duplicated, JS modified the value of the cookie, the original value of the cookie will also be effective, alert after the show "cityid=3;cityid=13;", so backstage get still cityid=3, too weird. All other browsers are normal.

function delCookie(name){    document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT";}

This method is used to delete cookies normally

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.