Home >Backend Development >PHP Tutorial > PHP if. elseif.else 有关问题

PHP if. elseif.else 有关问题

WBOY
WBOYOriginal
2016-06-13 12:31:49720browse

PHP if.. elseif...else 问题

本帖最后由 xytianshiwx 于 2013-12-08 10:09:44 编辑
    <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 />


 $param 没有赋值个$sql_param_list["field"]??
逻辑错误还是其他错误,请高手指点指点!!!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn