-3
我在phpweather腳本「ereg deprecated」中遇到錯誤。將ereg更改爲preg
如果任何人都可以用ereg替換這個表達式,我會非常感激。
ereg("^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$", $file, $regs))
請,如果你能解釋你是如何做到這一點。 謝謝。
我在phpweather腳本「ereg deprecated」中遇到錯誤。將ereg更改爲preg
如果任何人都可以用ereg替換這個表達式,我會非常感激。
ereg("^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$", $file, $regs))
請,如果你能解釋你是如何做到這一點。 謝謝。
添加#封裝模式...
preg_match("#^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$#", $file, $regs));
你嘗試過什麼?您可以先閱讀[manual](http://php.net/manual/en/reference.pcre.pattern.syntax.php)的PCRE部分... – DaveRandom 2012-01-15 10:14:43
[將ereg表達式轉換爲preg] (http://stackoverflow.com/questions/6270004/converting-ereg-expressions-to-preg) – mario 2012-01-15 23:39:59