0
securityToken|s:32:"c75f10164c568e9561b6287a4616a554";customers_host_address|s:9:"localhost";cartID|s:0:"";cart|O:12:"shoppingCart":8:{s:8:"contents";a:0:{}s:5:"total";i:0;s:6:"weight";i:0;s:6:"cartID";N;s:12:"content_type";b:0;s:18:"free_shipping_item";i:0;s:20:"free_shipping_weight";i:0;s:19:"free_shipping_price";i:0;}navigation|O:17:"navigationHistory":2:{s:4:"path";a:3:{i:0;a:4:{s:4:"page";s:13:"products_sale";s:4:"mode";s:6:"NONSSL";s:3:"get";s:0:"";s:4:"post";a:0:{}}i:1;a:4:{s:4:"page";s:14:"page_not_found";s:4:"mode";s:6:"NONSSL";s:3:"get";s:0:"";s:4:"post";a:0:{}}i:2;a:4:{s:4:"page";s:5:"index";s:4:"mode";s:6:"NONSSL";s:3:"get";a:1:{s:8:"refer_id";s:4:"1900";}s:4:"post";a:0:{}}}s:8:"snapshot";a:0:{}}check_valid|s:4:"true";country|s:3:"all";language|s:7:"english";languages_id|s:1:"1";languages_code|s:2:"en";currency|s:3:"USD";currency_value|s:10:"1.00000000";today_is|s:10:"2013-10-23";updateExpirations|b:1;recent_products|a:0:{}customers_ip_address|s:9:"127.0.0.1";jy_traffic|a:1:{i:0;a:8:{s:10:"out_domain";s:9:"localhost";s:8:"out_link";s:29:"http://localhost/leb/test.php";s:11:"persun_link";s:24:"/index.php?refer_id=1900";s:8:"refer_id";s:4:"1900";s:2:"ip";s:9:"127.0.0.1";s:9:"link_date";s:19:"2013-10-23 06:18:22";s:9:"stay_time";i:0;s:2:"id";i:112;}}jy_traffic_static|a:4:{s:8:"out_link";s:29:"http://localhost/leb/test.php";s:10:"out_domain";s:9:"localhost";s:8:"refer_id";s:4:"1900";s:2:"ip";s:9:"127.0.0.1";}

我正在使用zencart,会话存储在数据库中,这个会话是来自db的base64_uncode,但不是数组,我尝试使用unserialize($str),它不能更改为数组。有人知道怎么翻译吗?

4

1 回答 1

1

要从上述代码中提取安全令牌,您可以使用:

preg_match_all('/securityToken\|s:\d{1,3}:"\w*"/', $str, $out, PREG_PATTERN_ORDER);
preg_match('/"(.*?)"/', $out[0][0], $sessionVar);
echo $sessionVar[0];
于 2013-10-23T06:49:03.840 回答