【发布时间】:2010-11-11 15:39:09
【问题描述】:
我有以下函数来返回脚本的干净路径。
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]:编译 failed: missing ) at offset 7 in C:\wamp\www\extlogin\app\ni\inc\classes\cfiletree.php 在线 18
关于什么是错的以及如何解决它的任何想法?
谢谢。
【问题讨论】:
标签: php preg-replace