Array ( [PHPSESSID] => j1apkcui1jnhmd68qi2ehi0qn2 [cookie] => a:14:{s:3:"qty";a:4:{i:49;s:0:"";i:50;s:0:"";i:51;s:0:"";i:52;s:0:"";}s:15:"dealership_name";
s:6:"mytest";s:16:"regional_manager";s:4:"test";s:15:"order_placed_by";s:4:"test";s:13:"contact_phone";s:4:"test";s:21:"attention_delivery_to";
s:4:"test";s:5:"email";s:24:"sheikhusman545@gmail.com";s:11:"street_name";
s:54:"house no 6 street no 111 aziza street islampura lahore";s:6:"suburb";s:6:"lahore";s:5:"state";s:4:"test";s:8:"postcode";s:4:"test";s:20:"special_instructions";s:5:"tsest";s:14:"Payment_Amount";s:1:"1";s:12:"submit_order";s:0:"";} )
我如何在php中取消设置这个数组我在cookie中保存帖子值然后在页面中使用它现在我希望它在我反序列化之后被删除它可以有人请指导我吗?
答案 0 :(得分:1)
如果要清理/删除$ _COOKIE变量:
-Djava.util.logging.config.file=${project.basedir}/src/test/resources/logging.properties
如果您只想删除特定的Cookie(例如$ _COOKIE [" Cookie"]):
// unset cookies
if (isset($_SERVER['HTTP_COOKIE'])){
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
答案 1 :(得分:0)
这是一个解决方案:
foreach($_COOKIE as $cookie)
{
unset($_COOKIE[$cookie]);
}
离开我的头顶,我看不出有什么问题?
答案 2 :(得分:0)
警告:请注意,当前$_COOKIE
变量中的Cookie值可能会setcookie()
保持不变,您最终需要取消设置与unset($_COOKIE[$cookie_name]);