我想在数据库中插入以逗号分隔的“ http //”链接
这种形式是:

https://stackoverflow.com/questions/ask,
https://stackoverflow.com/questions/ask,
https://stackoverflow.com/questions/ask,


那是我的插入查询

$url = array($_REQUEST[url_name]);
$arr = implode(',', $url);
mysql_query("insert into url(url_name)values('$arr')");


http链接怎么可能用逗号分隔保存在数据库中?

最佳答案

这不是存储价值的好习惯。

使用base64_encode

$ a =“ https://stackoverflow.com/questions/ask,https://stackoverflow.com/questions/ask,https://stackoverflow.com/questions/ask

base64_encode($a);


获得原始值:base64_decode

base64_decode($a);

10-08 07:15