我有以下函数来返回脚本的干净路径。
function cleanPath($path) {
$path = (string) $path;
$path = preg_replace(
array(
'#[\n\r\t\0]*#im',
'#/(\.){1,}/#i',
'#(\.){2,}#i',
'#(\.){2,}#i',
'#('.DIRECTORY_SEPARATOR.'){2,}#i'
),
array(
'',
'',
'',
'/'
),
$path
)
;
return rtrim($path,DIRECTORY_SEPARATOR);
}
PHP给出错误:
警告:preg_replace() [function.preg-replace]: Compilation failed: missing ) 在第18行 C:\wamp\www\extlogin\app\ni\inc\classes\cfiletree.php中的偏移量 7
关于什么是错的以及如何解决它的任何想法?
谢谢你。