When I made a small collection and publishing interface today, I found that an error was prompted when I used the implode function, but I couldn't solve it after I found it on the internet. later I checked it carefully because the writing was wrong, of course, I have learned a lot about this problem. I have sorted out some more reasonable ways to use implevels... when I made a small collection and publishing interface today, I found that an error was prompted when I used the implode function, but I couldn't solve it after I found it on the internet. later I checked it carefully because the writing was wrong, of course, I have also learned a lot about this problem. I have sorted out some more reasonable use of the implode () function.
The code of my program is as follows:
Echo $ fileddata ['House _ feature ']; if ($ fileddata ['House _ feature']) {$ fileddata ['House _ feature '] = implode (' | ', $ fileddata ['House _ feature']);} echo '----'. $ fileddata ['House _ feature ']
Result: North-South transparent | house view at any time | convenient transportation --------
I did not find out the cause repeatedly. baidu searched for a netizen who said that implode (',', $ goods_attr) was not scientific at all and should be judged. if ($ goods_attr), can this implode only convert the array into characters? Baidu's mplode () function combines array elements into a string.
Parameter description
Optional. specifies the content to be placed between array elements. the default value is "" (null string ).
Array is required. it must be an array of strings.
The code is as follows:
$ Fileddata ['House _ feature '] = str_replace (' | ', $ fileddata ['House _ feature']);
Test the North-South visibility | visit the house at any time | the transportation is convenient and the North-South visibility is provided at any time. convenient transportation is the result I want.
Tutorial address:
Reprinted! But please include the article address ^