如何匹配路径分隔符
$win_dir = 'C:\hello.txt';
$linux_dir = '/home/hello.txt';
如何使用preg_match()
对变量$win_dir
如何匹配出\
并输出。以及对$linux_dir
如何匹配出/
并输出。还有如何匹配出\\
或者//
谢谢各位!!
如何匹配路径分隔符
$win_dir = 'C:\hello.txt';
$linux_dir = '/home/hello.txt';
如何使用preg_match()
对变量$win_dir
如何匹配出\
并输出。以及对$linux_dir
如何匹配出/
并输出。还有如何匹配出\\
或者//
谢谢各位!!
2 回答2.4k 阅读✓ 已解决
2 回答1k 阅读✓ 已解决
2 回答1.4k 阅读✓ 已解决
1 回答1.5k 阅读✓ 已解决
1 回答819 阅读✓ 已解决
895 阅读
1 回答655 阅读
无需用正则匹配的,用PHP自带的
DIRECTORY_SEPARATOR
即可,windows平台输出
\
,Linux平台输出/