如何匹配路径分隔符
$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 回答1.2k 阅读✓ 已解决
2 回答753 阅读✓ 已解决
1 回答947 阅读✓ 已解决
1 回答648 阅读✓ 已解决
2 回答815 阅读
1 回答817 阅读
1 回答751 阅读
无需用正则匹配的,用PHP自带的
DIRECTORY_SEPARATOR
即可,windows平台输出
\
,Linux平台输出/