作者Godkin (Nostalgie)
看板PHP
标题[请益] substr的使用
时间Wed Jun 1 16:56:35 2011
请问各位前辈,
$string="/home/guest/dir_path/test_output.dat";
我现在想使用substr去抓取最後的test_output.dat
该怎麽做呢? 是得先用正规表示法处理吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.116.215.175
1F:→ MOONRAKER:可以用regex,或用strrpos()找出最後一个"/"的位置 06/01 17:04
2F:→ roga:到 php.net 找 pathinfo 或是 basename 这两个 func 06/01 17:09
3F:→ Godkin:感谢感谢!! 搞定了~~ 06/01 17:15
4F:推 chchwy:我喜欢用strrchr() 06/01 18:19
5F:→ MOONRAKER:basename卡方便。 06/01 18:41
6F:→ gname:basename +1 06/01 23:20