Home >Backend Development >PHP Tutorial >php拼接字符串没有用?该如何解决

php拼接字符串没有用?该如何解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:02:011150browse

php拼接字符串没有用?
$str.=$array[$i]."|\."; 这是我的字符串拼接,给每个数组元素后面加一个 ‘|\.’ 字符,添加完了整个字符串只有手尾有符号,其他地方都没有,为什么?
------解决方案--------------------

我复制你的代码执行了一下,都有啊!
------解决方案--------------------

<br />$str = '';<br />$array = array('a','b','c');<br />for($i=0; $i<count($array); $i++){<br />	$str.=$array[$i]."<br><font color='#FF8000'>------解决方案--------------------</font><br>\.";<br />}<br /><br />echo $str;<br />


輸出:a
------解决方案--------------------
\.b
------解决方案--------------------
\.c
------解决方案--------------------
\.

沒有問題啊。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn