PHP if.. elseif...else 问题
<br /> <?php<br /> $field_func="COUNT|AVG|FIRST|LAST|MAX|MIN|SUM|TOP";<br /> $where_field="Where|or|xor|and|in";<br /> $param="name";<br /> $sql_param_list=array();<br /> if(false!==strpos($param,",")){//判断是否存在“,”<br /> $sql_param_list["field"] = $param;<br /> }else{<br /> if(preg_match("/\b(".strtolower($field_func).")\b\((\*|[a-zA-Z_`])+\)/i", $param)){<br /> $sql_param_list["field"] =$param;<br /> }elseif(preg_match("/\b(".$where_field.")\b/i", $param)||preg_match("/(>|>|=)/i", $param)){//判断where<br /> $sql_param_list["where"] =$param;<br /> <br /> }elseif(preg_match("/\b(order|limit|group|)\b/i", $param,$param_name)){//判断order|limit|group<br /> switch ($param_name[0]){<br /> case "order" : $sql_param_list["order"] =$param;<br /> break;<br /> case "limit" : $sql_param_list["limit"] =$param;<br /> break;<br /> case "group" : $sql_param_list["group"] =$param;<br /> break;<br /> <br /> }<br /> }else{<br /> $sql_param_list["field"] =$param;<br /> }<br /> } <br /> print_r($sql_param_list);<br /> <br />
}elseif(preg_match("/\b(order<br><font color='#FF8000'>------解决方案--------------------</font><br>limit<br><font color='#FF8000'>------解决方案--------------------</font><br>group<br><font color='#FF8000'>------解决方案--------------------</font><br>)\b/i", $param,$param_name)){//判断order<br><font color='#FF8000'>------解决方案--------------------</font><br>limit<br><font color='#FF8000'>------解决方案--------------------</font><br>group<br /> ==> "/\b(order<br><font color='#FF8000'>------解决方案--------------------</font><br>limit<br><font color='#FF8000'>------解决方案--------------------</font><br>group)\b/i", //正则多了个或<br /> <br />