humans_21909=1 error in codeigniter project

2020-02-14 08:33发布

Some controller functions in codeigniter is setting up humans_21909 cookie. And the page source appears to be as follows

<script>document.cookie = "humans_21909=1"; document.location.reload(true)</script>

The same project worls perfectly on local server. but on live server it shows this stuff.

3条回答
够拽才男人
2楼-- · 2020-02-14 08:38

This is a network related issue. I just switched my internet connection to different wifi and it works fine. Don't know more about this error but it solved by this way.

查看更多
【Aperson】
3楼-- · 2020-02-14 08:49

Once I degraded the PHP version, the error has gone. May be because codeigniter deperciated syntax or some other features in the new version. Thanks

查看更多
倾城 Initia
4楼-- · 2020-02-14 08:52

I have found that issue is coming from cookie. Please set a cookie in header.php file with project path in this after set of cookies page will reload without changing web URL

e.g

<script type="text/javascript">
function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
}
var accept = getCookie("humans_21909"); 
if (accept !="1") {
document.cookie = "humans_21909=1; path=/insert here project root path/"; 
    console.log("ok"); 
    (function()
    {
      if( window.localStorage )
      {
        if( !localStorage.getItem('firstLoad') )
        {
            console.log("refresh");
            localStorage['firstLoad'] = true;
            window.location.reload();
        }  
        else
          localStorage.removeItem('firstLoad');
      }
    })();
}

I think your issue with resolve with this

查看更多
登录 后发表回答