php跳转类 model

时间:2019-02-24 09:10:56
【文件属性】:

文件名称:php跳转类 model

文件大小:3KB

文件格式:ZIP

更新时间:2019-02-24 09:10:56

php 跳转类

db->query($sql)->result_array(); //查找 } function row($table,$where='',$select=0,$id='',$like=0,$a=0,$b=0){ $where = isset($where)&&!empty($where)?$where:''; $id = isset($id)&&!empty($id)?" order by ".$id." desc ":''; $a = isset($a)&&!empty($a)?$a:0; $b = isset($b)&&!empty($b)?$b:999999; $select = isset($select)&&!empty($select)?$select:'*'; $like = isset($like)&&!empty($like)?$like:'';//and cat_type like '%{$_POST['cat_type']}%' $sql = "select ".$select." from ".$table.$where.$like.$id." limit ".$a.",".$b.""; return $this->db->query($sql)->row_array(); //查找 } function num($table,$where='',$select=0,$id='',$like=0,$a=0,$b=0){ $where = isset($where)&&!empty($where)?$where:''; $id = isset($id)&&!empty($id)?" order by ".$id." desc ":''; $a = isset($a)&&!empty($a)?$a:0; $b = isset($b)&&!empty($b)?$b:999999; $select = isset($select)&&!empty($select)?$select:'*'; $like = isset($like)&&!empty($like)?$like:'';//and cat_type like '%{$_POST['cat_type']}%' $sql = "select ".$select." from ".$table.$where.$like.$id." limit ".$a.",".$b.""; return $this->db->query($sql)->num_rows(); //查找 } function uer_quanxian($id){ //$_GET['id']传过来的控制器文件夹 控制器名字 方法名字 中间没有/ $sq = "select yz_qx_href from xf_qx where id=".$_SESSION['founder'].""; $res = $this->db->query($sq)->row_array(); $res = explode(',', $res['yz_qx_href']); //p($res);exit(); foreach ($res as $key => &$value) { $sqss = "select id,yz_ci_href from xf_qx_ci where id=".$value.""; $value= $this->db->query($sqss)->result_array(); } $k = 0; foreach ($res as $key => $val) { foreach ($val as $key2 => $val2) { $newhello[$k]['id'] = $val2['id']; $newhello[$k]['yz_ci_href'] = $val2['yz_ci_href']; $k++; } } foreach ($newhello as $key => $value) { if ($value['yz_ci_href']== $_GET['id']) { echo $_GET['id']; }else{ echo "2"; } } } function getfirstchar($s0){ $firstchar_ord=ord(strtoupper($s0{0})); if (($firstchar_ord>=65 and $firstchar_ord<=91)or($firstchar_ord>=48 and $firstchar_ord<=57)) return $s0{0}; $s=iconv("UTF-8","gb2312", $s0); $asc=ord($s{0})*256+ord($s{1})-65536; if($asc>=-20319 and $asc<=-20284)return "A"; if($asc>=-20283 and $asc<=-19776)return "B"; if($asc>=-19775 and $asc<=-19219)return "C"; if($asc>=-19218 and $asc<=-18711)return "D"; if($asc>=-18710 and $asc<=-18527)return "E"; if($asc>=-18526 and $asc<=-18240)return "F"; if($asc>=-18239 and $asc<=-17923)return "G"; if($asc>=-17922 and $asc<=-17418)return "H"; if($asc>=-17417 and $asc<=-16475)return "J"; if($asc>=-16474 and $asc<=-16213)return "K"; if($asc>=-16212 and $asc<=-15641)return "L"; if($asc>=-15640 and $asc<=-15166)return "M"; if($asc>=-15165 and $asc<=-14923)return "N"; if($asc>=-14922 and $asc<=-14915)return "O"; if($asc>=-14914 and $asc<=-14631)return "P"; if($asc>=-14630 and $asc<=-14150)return "Q"; if($asc>=-14149 and $asc<=-14091)return "R"; if($asc>=-14090 and $asc<=-13319)return "S"; if($asc>=-13318 and $asc<=-12839)return "T"; if($asc>=-12838 and $asc<=-12557)return "W"; if($asc>=-12556 and $asc<=-11848)return "X"; if($asc>=-11847 and $asc<=-11056)return "Y"; if($asc>=-11055 and $asc<=-10247)return "Z"; return null; } //查找 public function getAll($table='',$where=array(),$select=''){ return $this->db->select($select)->where($where)->get($table)->result_array(); }//添加成功 function add($a){ $b= site_url($a); $this->halt($b,"添加成功",0); } function edit($a){ $b= site_url($a); $this->halt($b,"修改成功",0); } function del($a){ $b= site_url($a); $this->halt($b,"删除成功",0); } function view($a){ $b= site_url($a); $this->halt($b,"操作成功",0); } function view_del($a){ $b= site_url($a); $this->halt($b,"操作失败",4); }//查询 function select(){ $res=$this->db->get('yz_new_cate')->result_array(); foreach($res as $key=>$val){ $row=$this->db->where('cat_id',$val['cat_pid'])->get('yz_new_cate')->result_array(); if($row){ $res[$key]['father_name']=$row[0]['cat_name']; } } }//递归 function gui($arr,$html='|--',$pid=0,$level=0){ $str=array(); foreach($arr as $v){ if($v['cat_pid']==$pid){ $v['level']=$level + 1; $v['html']=str_repeat($html,$level); $str[]=$v; $str=array_merge($str,$this->gui($arr,$html,$v['cat_id'],$level+1)); } } return $str; } //递归是用方法cat_id 主id //top_id 主id是1 子类都是1 //cat_pid 关联的id 主id是1则他是1 主id是2 下一集是2 //cat_level 分级id 总类为1级 子类 为2 在往下为3 /** * @CopyRight * @WebSite * @Author turingphp-zy * @Brief 图片放到根目录 * $msgtype 0 成功 1警告 2失败 **/// 第三个参数等于0和1好用 等于2不太好用 //$b= site_url('yemian/apption/get_list'); // $this->s_model->halt($b,"增加成功",0); function halt($forwardurl,$message,$msgtype) {$a=base_url('imagess/return.gif'); $c=base_url('imagess/donghua.gif'); //$c=base_url('imagess/return.gif'); //define('STYLE_PATH',str_replace(base_url(),'',base_url())); //define('STYLE_PATH',str_replace($_SERVER['DOCUMENT_ROOT'],'',ROOT_DIR)); ?> 温馨提示

温馨提示

"); echo("

秒后 如果你的浏览器没有自动跳转,请点击此链接

"); break; case 3: echo(""); echo("

2秒后 如果你的浏览器没有自动跳转,请点击此链接

"); break; case 4: echo(""); echo("

2秒后 如果你的浏览器没有自动跳转,请点击此链接

"); break; case 1: echo("

"); break; case 2: echo("

"); break; default: break; case 5: echo(""); break; case 6: echo("

2秒后 如果你的浏览器没有自动跳转,请点击此链接

"); break; } ?>


【文件预览】:
s_model.php

网友评论