'\' and '\\' will both end up as a single '\' in the string which effectively reads \( to the preg parser which means you escape the '(' and so don't use it's function to capture characters for backreferences which renders the following ')' illegal since it tries to close a not opened '('. Therefore, \ -> \ and \\ -> \ so you need \\\ to get \\ in the string so you don't escape the (. Clear ? :)http://bugs.php.net/bug.php?id=16537&edit=1
\67得到7
\670得到不知名的字符?$current = 'D:\web\mambog_corp\sql\67-12-23';
$current = preg_replace("#\\([0-9])#i", "/\\1", $current);
$current = preg_replace("#\\\([0-9]+)#i", "/\\1", $current);
effectively reads \( to the preg parser which means you escape the '('
and so don't use it's function to capture characters for backreferences
which renders the following ')' illegal since it tries to close a not
opened '('. Therefore, \ -> \ and \\ -> \ so you need \\\ to get \\ in
the string so you don't escape the (. Clear ? :)http://bugs.php.net/bug.php?id=16537&edit=1
双引号括起的字符串中含有的\,在变量传递过程中,会被系统默认处理。\200就被处理成了那个貌似字母e被穿了一刀的样子的字符。靠。所以要用单引号。或者对所有\再加个\变成\\$current = "D:\web\mambog_corp\sql\2005-12-23";
$current = preg_replace("#\\([0-9])#i", "/\\1", $current);