dpa89292 2014-02-17 23:58
浏览 16

如何将变量与连接它们的逗号分开并显示它们? [重复]

This question already has an answer here:

In a foreach loop I upload some photos and store their values into one variable seperated by a comma as below

$photos.=$file_name.",";

When the files are uploaded, in the DB it is saved as

01461135_1015205099943781_302247337_n.jpg,11534328_56640920111689_2120954548_n.jpg,2160948_470329406422631_1521154943_n.jpg,

please mind the , at the end.

My aim is to echo them later like below

        <li>
            <img src="images/car1.jpg" />
        </li>

My question is how can I separate the pictures knowing that the comma is at the end of the filename?

</div>
  • 写回答

3条回答 默认 最新

  • dongwaner1367 2014-02-18 00:01
    关注

    u can use the explode

    explode (',',$UR-ARRAY,10);
    

    for more example go to http://php.net/explode

    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思