// $accountPrice = $_GET['num'];
// $accountPrice = 111;
// $accountPrice = 1112.;
// $accountPrice = 2324.1;
// $accountPrice = 2324.15;
// $accountPrice = 2324.157;//wrong
// $accountPrice = 0.57;
if (preg_match('/^[0-9]+(.[0-9]{1,2})?$/', $accountPrice)) {
echo '整数或小数二位的正则';
}else{
echo '错';
}
原文地址:http://blog.51cto.com/13716819/2114329
时间: 2024-11-01 14:38:38