如何在php native中添加Apostrophe

前端之家收集整理的这篇文章主要介绍了如何在php native中添加Apostrophe前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个跟随字符串
$data = "20150825131738_262,20150825132227_241,20150825132254_898,20150825132320_209";

如何添加’in $data.结果输出如下

'20150825131738_262','20150825132227_241','20150825132254_898','20150825132320_209,20150825132346_124','20150825132406_744','20150825143522_447','20150828145011_928'

帮我谢谢

以下将给你想要的结果
$data = "20150825131738_262,20150825132320_209";
$data_array = explode(',',$data);
$data = "'". implode("','",$data_array) . "'";
print_r($data);

看它在线运行here

原文链接:https://www.f2er.com/php/133655.html

猜你在找的PHP相关文章