php 接口示例
2016-04-01 13:05
288 查看
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(); }
相关文章推荐
- php 接口示例
- php分享(三十五) 文件多写注意事项
- PHP使用SOAP扩展实现WebService的方法
- yii2搭建完美后台并实现rbac权限控制
- PHP全局变量与超级全局变量区别分析
- PHP运行方式
- php的simplexml
- WordPress 后台提示输入FTP信息
- PHP计算数组中值的和与乘积的方法(array_sum与array_product函数)
- PHP采用超长(超大)数字运算防止数字以科学计数法显示的方法
- PHP页面3中跳转方法
- php中session的用法
- php configure编译报错
- php编译参数详解
- php垃圾回收和内存管理机制
- PHP实现301重定向
- 通用的FragmentPagerAdapter
- 深入理解PHP内核(十四)类的成员变量及方法
- 深入理解PHP内核(十三)类的结构和实现
- 深入理解PHP内核(十二)函数-函数的定义、传参及返回值