如何匹配路径分隔符
$win_dir = 'C:\hello.txt';
$linux_dir = '/home/hello.txt';
如何使用preg_match()对变量$win_dir如何匹配出\并输出。以及对$linux_dir如何匹配出/并输出。还有如何匹配出\\或者//
谢谢各位!!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
无需用正则匹配的,用PHP自带的
DIRECTORY_SEPARATOR即可,windows平台输出
\,Linux平台输出/