21,886
社区成员
发帖
与我相关
我的任务
分享
//遵循规则的排版,难看:
function path($file) {
if (defined('PSTATIC') && PSTATIC) {
foreach (PStatic::$rules as $key => $val) {
if (preg_match($key, $file)) {
return preg_replace($key, $val, $file);
}
}
}
return $file;
}
//相对较难理解的逻辑,只为了紧凑一点,难道我太无聊了?
function path($file) {
if (!defined('PSTATIC') || !PSTATIC) return $file;
foreach (PStatic::$rules as $key => $val)
if (preg_match($key, $file)) return preg_replace($key, $val, $file);
return $file;
}