PHP中的格式字符串

时间:2015-07-21 11:42:32

标签: php

我有以下代码,它将文件路径设为voicetube/record/1985150721112615 但我只需1985150721112615爆炸前两个文件夹,请帮我解决这个问题

$sql = "SELECT filePath FROM user_recordings ORDER BY recordDate ASC";
$result = mysql_query($sql);
$var = array();
while ($row = mysql_fetch_array($result)) 
{
    $var[] = $row['filePath'];
}

2 个答案:

答案 0 :(得分:3)

您正在寻找basename();

 public DrawingXmppServices(SurfaceViewCanvas surfaceView) {
            chat = chatManager.createChat(BUDDY, new MyChatListener());
            chat.addMessageListener(new MyChatListener());
            receiver = surfaceView;
        }
public void sendDrawingData(String drawingData, String buddyId) {
        try {
            chat.sendMessage(drawingData);
        } catch (XMPPException e) {
            e.printStackTrace();
        }
    }

答案 1 :(得分:0)

您可以使用explode功能,并抓住它的最后一个索引。

config.threadsafe!