//get id 获取内容,调用xml方法
public function get(){
$id = $_GET['id'];//接收id
$User = M('user');
//$val->where("id = $id")->select();
$data=$User->where( "id = $id" )->find();
$this->arrtoxml($data);
//dump($val);
//dump($id);
} //封装成xml
public function arrtoxml($data,$dom=0,$item=0){
if (!$dom){
$dom=new DOMDocument("1.0");
}
if(!$item){
$item=$dom->createElement("cti");
$dom->appendChild($item);
}
foreach ($data as $key=>$val){
$itemx=$dom->createElement(is_string($key)?$key:"item");
$item->appendChild($itemx);
if (!is_array($val)){
$text =$dom->createTextNode($val);
$itemx->appendChild($text); }else{
$this->arrtoxml($val,$dom,$itemx);
} } header('Content-Type:text/xml');
dump($dom->saveXML());
} //get id 获取内容,调用json方法
public function find(){
$id = $_GET['id'];//接收id
$User = M('user');
//$val->where("id = $id")->select();
$data=$User->where( "id = $id" )->find();
$this->json($data);
//dump($val);
//dump($id);
} //封装json方法
public function json($data){
foreach($data as $key=>$value){
$jobj->$key=$value;
}
//print_r($jobj);//打印传递属性后的对象
//echo '使用$jobj->row[0][\'code\']输出数组元素:'.$jobj->row[0]['code'].'<br>';
echo '编码后的json字符串:'.json_encode($jobj).'<br>';//打印编码后的json字符串 } //get id and account 获得内容并显示出来
public function un(){
$account = $_GET['account'];//接收account
$id=$_GET['id'];//接收密码
$User = M('user'); //$condition = new stdClass();
$condition['account'] = $account;
$condition['id'] = $id; //$val->where("id = 1")->select();
$User->where($condition)->find();
//$this->json($data);
dump($_GET);
dump($User);
dump($condition);
} //get account and password,调用json方法
public function up(){
$account = $_GET['account'];//接收account
$password=$_GET['password'];//接收密码
$User = M('user'); //$condition = new stdClass();
$condition['account'] = $account;
$condition['password'] = $password; //$val->where("id = 1")->select();
$data=$User->where($condition)->find();
//$this->json($data);
//dump($_GET);
//dump($User);
//dump($condition); $this->json($data);
}

http://localhost/rbac/Public/up?account=admin&password=admin 改进

thikphp 简单的接口骨架的更多相关文章

  1. 如何简单实现接口自动化测试(基于 python) 原博主地址https://blog.csdn.net/gitchat/article/details/77849725

    如何简单实现接口自动化测试(基于 python) 2017年09月05日 11:52:25 阅读数:9904 GitChat 作者:饿了么技术社区 原文:如何简单实现接口自动化测试(基于 python ...

  2. SoapUI 利用SoapUI进行简单的接口并发测试

    利用SoapUI进行简单的接口并发测试 by:授客 QQ:1033553122 测试环境: SoapUI Pro 5.1.2 步骤如下 1.   把请求添加到测试套件 1.1.     途径1 1.新 ...

  3. 简单实现接口自动化测试(基于python+unittest)

    简单实现接口自动化测试(基于python+unittest) 简介 本文通过从Postman获取基本的接口测试Code简单的接口测试入手,一步步调整优化接口调用,以及增加基本的结果判断,讲解Pytho ...

  4. 落网数据库简单查询接口 caddy+php7+mongodb

    落网数据库简单查询接口 一个简单的DEMO,使用了caddy + php7 + mongodb 数据库&接口设计 来自 https://github.com/Aedron/Luoo.spide ...

  5. 用flask写一个简单的接口

    用falsk写一个简单的接口,这个接口的数据本来是爬虫爬取的数据,但是今天只写一个flask接口,数据就用测试数据好了. import random import re import time imp ...

  6. 【JMeter_05】创建第一个简单的接口脚本

    聚合数据:提供了很多开放的API,可以去练习使用https://www.juhe.cn/ 如果有小伙伴对HTTP协议不是很了解,可以看下这里 http://home.ustc.edu.cn/~xie1 ...

  7. Spring Data JPA 简单查询--接口方法

    一.接口方法整理速查 下表针对于简单查询,即JpaRepository接口(继承了CrudRepository接口.PagingAndSortingRepository接口)中的可访问方法进行整理.( ...

  8. jmeter的简单http接口用法

    1.  jmeter的启动:windows下的环境 进入jmeter的并目录双击启动 Mac电脑 进入bin目录找到jmeter.sh 文件 在终端执行./jmeter.sh 或者./jmeter. ...

  9. 基于kettle的简单HTTP接口监控

        需求:监控系统中使用的所有http接口,要求简单,易用. 一般的思路也就是发送get/post请求,然后检查接口的响应结果. 如果写代码,要处理http请求,检查http响应,实现发邮件,写d ...

随机推荐

  1. C++:借助tinyxml2读取XML文件

    // XMLT01.cpp : 定义控制台应用程序的入口点.//#include "stdafx.h"#include <iostream>#include " ...

  2. 固定尺寸内存块的缓冲队列类及C++实现源代码

    -------------------------------------------------------------------------------- 标题: 固定尺寸内存块的缓冲队列类及实 ...

  3. NewsLetter001

    http://www.learn-english-today.com/ Project management - Iron out problems. – resolve issues. Critic ...

  4. appserv - 最简单的绑定路径

    补充:此方法比较low. 推荐伪静态:http://www.cnblogs.com/CyLee/p/5544119.html 找到路径C:\AppServ\Apache24\conf\httpd.co ...

  5. sphinx 配置文件全解析(转)

    sphinx的配置文件是在配置的时候最容易出错的了: 我们先要明白几个概念: source:数据源,数据是从什么地方来的. index:索引,当有数据源之后,从数据源处构建索引.索引实际上就是相当于一 ...

  6. 请教中文的OCR软件哪个最好?

    对原件,有这几种:1,全中文(含标点,一些英文符号)2,中英文(英文较多,或英文占大多数)3,全英文(这个用finereader8.0) 針對1.2 紫光 超星阅读器自带的OCR组件 尚书七号搞定全中 ...

  7. [na]交换技术知识点-提纲

    vlan - trunk - vtp(vtp prune) stp portfast rootgurd bpduguard bpdufilter uplinkfast backbonfast loop ...

  8. 桶排序-py

    http://blog.chinaunix.net/uid-20775448-id-4222915.html 看了<啊哈算法>第一节,排序从小到大自己实现了. 从大到小,搜集了下资料.看了 ...

  9. Avoid strong reference cycles

    转自:http://masteringios.com/blog/2014/03/06/avoid-strong-reference-cycles/ With the introduction of A ...

  10. Flask教程 —— Web表单(上)

    第二章中介绍的request对象公开了所有客户端发送的请求信息.特别是request.form可以访问POST请求提交的表单数据. 尽管Flask的request对象提供的支持足以处理web表单,但依 ...