在PHP中将Cookie数据插入MySQL数据库? [英] Insert cookies data into MySQL database in PHP?

查看:422
本文介绍了在PHP中将Cookie数据插入MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:



在PHP中获取Cookie?

我有一些用户信息保存在cookie中,用户信息如下:

I have some users information saved in cookie, the users information are like this,

Fname:Muhammad, Lname:Riaz,title:Developer,org:MagicLamp,email:riaz@yaho.com
Fname:Fraz,Lname:Khan,title:Developer,org:MagicLamp,email:riaz@yaho.com

我要将这些信息插入到MySQL数据库中。问题是这样:我如何从一个cookie获取这个信息并插入数据库?

I want to insert these information in to MySQL database. The problem is this: how can I get this information from a cookie and insert into database?

推荐答案

$str = "";

foreach ($_COOKIE as $key => $value)
{
    $str .= $key . ":" . $value . ",";
}

$str = substr($str, 0, -1);

这篇关于在PHP中将Cookie数据插入MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆