| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | 
							- <?php
 
- /* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
- --	Api Process
 
- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
 
- header('Access-Control-Allow-Origin:*');
 
- header('Access-Control-Allow-Methods:POST,GET');
 
- include_once("config.php");
 
- include_once("functions.php");
 
- funcComAutoLoad(array('path' => 'configs/extension/', 'method' => 'include_once'));
 
- funcComAutoLoad(array('path' => 'applications/', 'method' => 'include_once'));
 
- funcComAutoLoad(array('path' => 'configs/database/conf' . $configs['system']['database'] . '.php', 'method' => 'include_once'));
 
- /* 规范参数 $post 不包含$_FILES*/
 
- $post = array();
 
- $_POST = array_merge($_POST, $_GET);
 
- $post = (file_get_contents('php://input')) ? (array)json_decode(file_get_contents('php://input'), true) : $_POST;
 
- /* 数据库连接 */
 
- $db = connectDB($configs['system']['database']);
 
- $returns = array('success' => false, 'errorcode' => '400', 'msg' => $configs['errors']['400']);
 
- /* 执行 */
 
- if(isset($post['func']) && $post['func']){
 
- 	list($post['application'], $post['handle']) = explode(".", $post['func']);
 
- 	
 
- 	if($_FILES){
 
- 		/* 上传文件操作 */
 
- 		$returns = $post['handle']($post, $_FILES);
 
- 	}else{
 
- 		$returns = $post['handle']($post['data']);
 
- 	}
 
- }
 
- //$post['Access-Session-Referrer-Server']['domain']
 
- /* 返回消息 */
 
- if(isset($post['jsonp'])){
 
- 	/* 跨域返回 */
 
- 	echo "callback(" . json_encode($returns) . ")";
 
- }else{
 
- 	echo json_encode($returns, JSON_UNESCAPED_UNICODE);
 
- }
 
- ?>
 
 
  |