From 7653c25c90048428a00d256a539e33d58c3c8039 Mon Sep 17 00:00:00 2001 From: LYN <273019164@qq.com> Date: Thu, 21 Apr 2016 14:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BD=BF=E7=94=A8php?= =?UTF-8?q?=E5=8F=91=E9=80=81http=E8=AF=B7=E6=B1=82=EF=BC=8C=E8=BF=94?= =?UTF-8?q?=E5=9B=9Ejson?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MinPHP/run/ah.php | 30 ++++++++ MinPHP/run/info.php | 177 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 MinPHP/run/ah.php mode change 100644 => 100755 MinPHP/run/info.php diff --git a/MinPHP/run/ah.php b/MinPHP/run/ah.php new file mode 100644 index 0000000..adbdc50 --- /dev/null +++ b/MinPHP/run/ah.php @@ -0,0 +1,30 @@ + array ( + 'method' => "POST", + 'header'=> "Content-type: application/x-www-form-urlencoded", + 'content' => $postdate + ) + ); + +if($posttype =="GET"){ + $url = $url."?" . $postdate; + $opts = array ( + 'http' => array ( + 'method' => 'GET' + ) + ); +} + +$context = stream_context_create($opts); +$html = file_get_contents($url , false, $context); + +echo $html; +//echo json_encode($html ."/n". $url ."/n". $context."/n". json_encode($parms); +?> \ No newline at end of file diff --git a/MinPHP/run/info.php b/MinPHP/run/info.php old mode 100644 new mode 100755 index 6d39209..3a6f170 --- a/MinPHP/run/info.php +++ b/MinPHP/run/info.php @@ -90,6 +90,44 @@ } $info['parameter'] = $info['parameter']; } + //测试接口 + }else if($op == 'testApi'){ + //执行编辑 + if($type == 'do'){ + $id = $_VAL['id']; //接口id + $num = htmlspecialchars($_POST['num'],ENT_QUOTES); //接口编号(为了导致编号的前导0去过滤掉。不用用I方法过滤) + $name = $_VAL['name']; //接口名称 + $memo = $_VAL['memo']; //备注 + $des = $_VAL['des']; //描述 + $type = $_VAL['type']; //请求方式 + $url = $_VAL['url']; //请求地址 + } + //编辑界面 + if(empty($id)){$id = I($_GET['id']);} + $aid = I($_GET['tag']); + //得到数据的详情信息start + $sql = "select * from api where id='{$id}' and aid='{$aid}'"; + $info = find($sql); + //得到数据的详情信息end + if(!empty($info)){ + $info['parameter'] = unserialize($info['parameter']); + $count = count($info['parameter']['name']); + $p = array(); + for($i = 0;$i < $count; $i++){ + $p[$i]['name']=$info['parameter']['name'][$i]; + $p[$i]['paramType']=$info['parameter']['paramType'][$i]; + $p[$i]['type']=$info['parameter']['type'][$i]; + $p[$i]['default']=$info['parameter']['default'][$i]; + $p[$i]['des']=$info['parameter']['des'][$i]; + } + $info['parameter'] = $info['parameter']; + } + //测试接口 + }else if($op == 'ah'){ + $url = $_VAL['url']; + $datas = $_VAL['dataparam']; + $posttype = $_VAL['posttype']; + echo "============================================="+ $datas; //此分类下的接口列表 }else{ $sql = "select api.id,aid,num,url,name,des,parameter,memo,re,lasttime,lastuid,type,login_name @@ -421,6 +459,122 @@ function del(obj){ } + + +
参数名 | +参数类型 | +必传 | +值 | +
---|---|---|---|
+ + | ++ + | ++ + + | ++ + |
编号 :
@@ -497,6 +653,20 @@ function del(obj){ + +