本文介绍了如何在php中内爆数组元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在php中将数组元素内嵌到单个字符串中

How implode array element into single string in php

$name = array( 'id', "no", "date",'fadd');
echo  implode("','",$name);

我要寻找的输出是

'id', 'no', 'date', 'fadd'


推荐答案

您已经找到了正确的内爆部分,只需在前后前后显式地引用引号即可获取开头和结尾的字符:

You've got the implode part right, just explicitly echo a quote before and after to get the leading and trailing characters:

$name = array( 'id', "no", "date",'fadd');
echo  "'" . implode("','",$name) . "'";

这篇关于如何在php中内爆数组元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:13
查看更多