0
我使用它使用eregi到的preg_match
$pattern = "LIMIT[^\w]{1,}([0-9]{1,})([\,]{0,})([0-9]{0,})";
$replacement = "";
eregi($pattern, $query, $regs);
$query = eregi_replace($pattern, $replacement, $query);
if($regs[2])
$query = str_ireplace("SELECT ", "SELECT TOP ".$regs[3]." ", $query);
else
{
if($regs[1])
$query = str_ireplace("SELECT ", "SELECT TOP ".$regs[1]." ", $query);
}
一個lib我更改代碼的某些部分,以
$pattern = "/LIMIT[^\w]{1,}([0-9]{1,})([\,]{0,})([0-9]{0,})/i";
$replacement = "";
preg_match($pattern, $query, $regs);
但現在我得到錯誤信息,說「未定義抵消:2」和「未定義偏移:1"
我覺得從eregi到的preg_match應該是很容易感動......
謝謝,隊友!愚蠢的錯誤..嘿嘿.. – Iyas 2012-01-13 08:54:11