$sql = 'SELECT * FROM `epc_user` GROUP BY userID ORDER BY `userNo` ASC,xxx DESC limit 0,30';
preg_match('/order\s+by\s+(.*?)\s?(limit|$)/i', $sql, $matches);
print_r($matches);
Array (
[0] => ORDER BY `userNo` ASC,xxx DESC limit
[1] => `userNo` ASC,xxx DESC
[2] => limit )
2 則留言:
來留下一點自己的看法
使用以下的敘述應該會比較符合吧
/order\s+by\s+(.*?)(?=\slimit|$)/i
很感謝你的意見.
張貼留言