通过ajax请求更新cookie的值 [英] update the value of a cookie via an ajax request
问题描述
如何为我的localhost应用程序更新cookie的值...
我正在尝试通过ajax请求更新,但它创建了两个cookie。 。
这是我使用的PHP代码..
$ sessionManifestName = manifest _ .md5(time())。 。xml;
if(isset($ _COOKIE [ TMP_MANIFEST])){
setcookie( TMP_MANIFEST, ,time() - 3600, /);
}
的setcookie(<跨度类= 代码串> 跨度> <跨度类= 代码串 > TMP_MANIFEST跨度>,$ sessionManifestName, time()+ 3600, /);
但它在不同的目录中创建两个具有不同值的cookie。
来自根...我有一个cookie,但它们是两个包含这个脚本的目录。
那是..
in ./我有一个./myapp/controller中的TMP_MANIFEST但是
- 我有两个具有不同值的TMP_MANIFEST cookie。
我该如何解决这个问题?
sessionManifestName 跨度> = <跨度类= 代码串> 跨度> <跨度类= 代码串 >清单_ .md5(time())。 。xml;
if(isset(
_COOKIE [ TMP_MANIFEST 跨度>])){
的setcookie(<跨度类= 代码串 >跨度> <跨度类= 代码串> TMP_MANIFEST跨度>,<跨度class =code-string> ,time() - 3600, /);
}
setcookie( TMP_MANIFEST,
sessionManifestName,time()+ 3600, /);
但是它会在不同的目录中创建两个具有不同值的cookie。
来自root的
...我有一个cookie,但它们是包含这个脚本的目录中的两个。
即...
in ./我有一个TMP_MANIFEST但是
in ./myapp/controller-我有两个不同值的TMP_MANIFEST cookie。
我该如何解决这个问题?
How can i update the value of a cookie for my localhost application ...
I am trying to update via an ajax request but its creating two cookies..
this is the php code iam using..
$sessionManifestName = "manifest_".md5( time() ).".xml";
if( isset ( $_COOKIE["TMP_MANIFEST"] ) ){
setcookie( "TMP_MANIFEST", "", time()-3600, "/" ) ;
}
setcookie( "TMP_MANIFEST", $sessionManifestName, time()+3600 , "/" ) ;
But it creates two cookies with the same in different directories with different values..
from the root... i have one cookie but they are two in the dir which contains this script.
that is..
in ./ i have one TMP_MANIFEST but
in ./myapp/controller - i have two TMP_MANIFEST cookies with different values.
How can i fix this?
sessionManifestName = "manifest_".md5( time() ).".xml"; if( isset (
_COOKIE["TMP_MANIFEST"] ) ){ setcookie( "TMP_MANIFEST", "", time()-3600, "/" ) ; } setcookie( "TMP_MANIFEST",
sessionManifestName, time()+3600 , "/" ) ;
But it creates two cookies with the same in different directories with different values..
from the root... i have one cookie but they are two in the dir which contains this script.
that is..
in ./ i have one TMP_MANIFEST but
in ./myapp/controller - i have two TMP_MANIFEST cookies with different values.
How can i fix this?
这篇关于通过ajax请求更新cookie的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!