Home > php教程 > php手册 > body text

自动过虑POST数据

WBOY
Release: 2016-06-06 19:32:06
Original
1008 people have browsed it

无详细内容 无 //获取当前表中的所有字段public function _facade($post){$data = array();$arr=array();$sql = 'select * from '.$this-table;$res = $this-db-ftable($sql);for($i=0;$imysql_num_fields($res);$i++){$m = mysql_fetch_field($res);$m = $m-

	//获取当前表中的所有字段
	public function _facade($post){
		$data = array();
		$arr=array();
		$sql = 'select * from '.$this->table;
		$res = $this->db->ftable($sql);
		for($i=0;$i<mysql_num_fields($res);$i++){
			$m = mysql_fetch_field($res);
			$m = $m->name;
			if(!in_array($m,$arr)){
				array_push($arr,$m);
			}
		}
		foreach($post as $k=>$v){
			if(in_array($k,$arr)){//判断$K是否为数组的字段,如果不是追加
				$data[$k]=$v;
			}
		}
		return $data;
	}
Copy after login
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template