【问题标题】:Issues Creating cookie with evercookie using js api in php在 php 中使用 js api 使用 evercookie 创建 cookie 的问题
【发布时间】:2015-09-04 21:34:15
【问题描述】:

我想用 ever cookie 创建永久 cookie,但是当我在 localhost(Php wamp 服务器)上运行 ever cookie 程序时,它不会创建任何 cookie 并显示以下错误

Not Found
The requested URL /php/evercookie_etag.php was not found on this server.

Not Found
The requested URL /php/evercookie_cache.php was not found on this server.

我已经从这个链接下载了它http://github.com/samyk/evercookie

我想创建一个永久 cookie,以便我可以识别运行我的网页的系统下面是我的代码,请帮助解决我的问题,在此先感谢....

<html>
<head>
<script type="text/javascript" src="js/swfobject-2.2.min.js"></script>
<script type="text/javascript" src="js/evercookie.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script>
//var ec = new evercookie();  
var ec = new evercookie({
        baseurl: '/test', http://localhost/test
        asseturi: '/assets', http://localhost/test/assets
        phpuri: '/php' http://localhost/test/php
    });


ec.set("id", "12345");


ec.get("id", function(value) { alert("Cookie value is " + value) });


function getCookie(best_candidate, all_candidates)
{
    alert("The retrieved cookie is: " + best_candidate + "\n" +
        "You can see what each storage mechanism returned " +
        "by looping through the all_candidates object.");

    for (var item in all_candidates)
        document.write("Storage mechanism " + item +
            " returned " + all_candidates[item] + " votes<br>");
}
ec.get("id", getCookie);
</script>
</head>
</html>

【问题讨论】:

    标签: java javascript php cookies evercookie


    【解决方案1】:

    您确定您的 baseurl 变量是 '/test' 吗?例如,使用 github 源代码,它将是:

    var ec = new evercookie({
        baseurl: '/evercookie-master',
        asseturi: '/assets',
        phpuri: '/php'
    });
    

    【讨论】:

      猜你喜欢
      • 2015-04-24
      • 1970-01-01
      • 2017-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多