From eed5862fcd0c09cd03d3e1e5d82e0f33720ac10b Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Tue, 24 Apr 2018 13:36:27 +0800
Subject: [PATCH] 兼容
---
PhalApi/PhalApi/Request.php | 5 ++---
Yfs/Api/Data.php | 2 +-
Library/MyRequest.php | 19 +++++++++++++++++++
Public/index.php | 1 +
Public/yfs/index.php | 3 ++-
Public/Request/MyRequest.php | 19 +++++++++++++++++++
PhalApi/PhalApi/Loader.php | 1 -
7 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/Library/MyRequest.php b/Library/MyRequest.php
new file mode 100644
index 0000000..4feb330
--- /dev/null
+++ b/Library/MyRequest.php
@@ -0,0 +1,19 @@
+<?php
+
+class MyRequest extends PhalApi_Request{
+ public function __construct($data = NULL) {
+ parent::__construct($data);
+
+ // json������
+ $this->post = file_get_contents('php://input');
+
+ // ������xml������
+ //$this->post = simplexml_load_string (
+ // file_get_contents('php://input'),
+ // 'SimpleXMLElement',
+ // LIBXML_NOCDATA
+ //);
+ //$this->post = json_decode(json_encode($this->post), TRUE);
+ }
+}
+
diff --git a/PhalApi/PhalApi/Loader.php b/PhalApi/PhalApi/Loader.php
index 0c91453..112e217 100644
--- a/PhalApi/PhalApi/Loader.php
+++ b/PhalApi/PhalApi/Loader.php
@@ -97,7 +97,6 @@
protected function loadClass($path, $className) {
$toRequireFile = $path . DIRECTORY_SEPARATOR
. str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
-
if (file_exists($toRequireFile)) {
require_once $toRequireFile;
return TRUE;
diff --git a/PhalApi/PhalApi/Request.php b/PhalApi/PhalApi/Request.php
index ad9ffca..2134c98 100644
--- a/PhalApi/PhalApi/Request.php
+++ b/PhalApi/PhalApi/Request.php
@@ -50,7 +50,7 @@
* @var string ���������������������
*/
protected $actionName;
-
+
/**
* - ���������������������������������������������������������������������������������������������
*
@@ -83,10 +83,9 @@
// ���������������
$this->headers = $this->getAllHeaders();
$this->get = $_GET;
- $this->post = !empty($_POST)?$_POST:file_get_contents('php://input');
+ $this->post = $_POST;
$this->request = $_REQUEST;
$this->cookie = $_COOKIE;
-
@list($this->apiName, $this->actionName) = explode('.', $this->getService());
}
diff --git a/Public/Request/MyRequest.php b/Public/Request/MyRequest.php
new file mode 100644
index 0000000..a552511
--- /dev/null
+++ b/Public/Request/MyRequest.php
@@ -0,0 +1,19 @@
+<?php
+
+class MyRequest extend PhalApi_Request{
+ public function __construct($data = NULL) {
+ parent::__construct($data);
+
+ // json������
+ $this->post = json_decode(file_get_contents('php://input'), TRUE);
+print_r($this->post);
+ // ������xml������
+ //$this->post = simplexml_load_string (
+ // file_get_contents('php://input'),
+ // 'SimpleXMLElement',
+ // LIBXML_NOCDATA
+ //);
+ //$this->post = json_decode(json_encode($this->post), TRUE);
+ }
+}
+
diff --git a/Public/index.php b/Public/index.php
index cada837..fb84e9c 100644
--- a/Public/index.php
+++ b/Public/index.php
@@ -8,6 +8,7 @@
//������������������
DI()->loader->addDirs('Yfs');
+
/** ---------------- ������������������ ---------------- **/
$api = new PhalApi();
$rs = $api->response();
diff --git a/Public/yfs/index.php b/Public/yfs/index.php
index 00f5182..eb8c646 100644
--- a/Public/yfs/index.php
+++ b/Public/yfs/index.php
@@ -4,10 +4,11 @@
*/
require_once dirname(__FILE__) . '/../init.php';
+DI()->loader->loadFile('Library/MyRequest.php');
+DI()->request = new MyRequest();
//������������������
DI()->loader->addDirs(array('Yfs', 'Library'));
-
/** ---------------- ������������������ ---------------- **/
$api = new PhalApi();
diff --git a/Yfs/Api/Data.php b/Yfs/Api/Data.php
index 95f4856..b68300e 100644
--- a/Yfs/Api/Data.php
+++ b/Yfs/Api/Data.php
@@ -8,7 +8,7 @@
public function getRules() {
return array(
'upload' => array(
- 'data' => array('name' => 'data', 'type' => 'array' ,'require' => true, 'desc' => '������������'),
+ 'data' => array('name' => 'data', 'type' => 'array', 'format' => 'json' ,'require' => true, 'desc' => '������������'),
),
'getUserDataList' => array(
'user_id' => array(
--
Gitblit v1.8.0