php 接口示例: public function dev(){ $m=new Model('machine_info'); $ip=$_GET['ip']; echo $ip; //$arr=$m->select(); $arr=$m->find($ip); var_dump($arr); }; 访问接口: http://localhost/thinkphp/index.php/Env/dev?ip=192.168.32.15 192.168.32.15 array (size=4) 'sn' => string '192' (length=3) 'ip' => string '192.168.32.122' (length=14) 'info' => string '' (length=0) 'env' => string 'env-xiaoping' (length=12) 由于find方法 找到记录为sn=192: find 获取单条数据 public function dev(){ $m=new Model('machine_info'); $ip=$_GET['ip']; echo $ip; //$arr=$m->select(); //$arr=$m->find($ip); $arr=$m->where('ip="192.168.32.15"')->getField('info'); var_dump($arr); //$name="赵杨健"; // $this->assign('data',$arr[0]['ip']); //$this->assign('data',$arr); //$this->display(); }