wupengfei 2 年之前
父节点
当前提交
0113759a67
共有 3 个文件被更改,包括 7 次插入4 次删除
  1. 2 0
      .idea/workspace.xml
  2. 3 1
      application/api/controller/Upload.php
  3. 2 3
      application/common.php

+ 2 - 0
.idea/workspace.xml

@@ -2,7 +2,9 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/application/api/controller/Upload.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Upload.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/common.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/common.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />

+ 3 - 1
application/api/controller/Upload.php

@@ -93,7 +93,9 @@ class Upload extends Base
         if ($file->checkExt('php,sh')) {
             $this->error('可执行文件禁止上传到本地服务器!');
         }
-        $res = requestPost('http://101.132.128.55:9999/v1/pdf/upload',json_encode($file));
+        $headers = [];
+        $headers[] = 'Content-Type: application/x-www-form-urlencoded';
+        $res = requestPost('http://101.132.128.55:9999/v1/pdf/upload',json_encode($file),$headers);
         var_dump($res);
 
 

+ 2 - 3
application/common.php

@@ -301,11 +301,10 @@ function get32Str($length='32'){
     Db::name('store_member')->where('id',$username)->update(array('hx_username'=>$param['username'],'hx_password'=>$param['password'],'hx_uuid'=>$hx_account['entities'][0]['uuid']));
     return true;
 }
-function requestPost($url , $post_data = array() ){
+function requestPost($url , $post_data = array(),$headers=[] ){
     // 1. 初始化一个cURL会话
-    $headers = array();
     //根据API的要求,定义相对应的Content-Type
-    array_push($headers, "Content-Type".":"."application/json");
+   // array_push($headers, "Content-Type".":"."application/json");
     $ch = curl_init();
     // 2. 设置请求选项, 包括具体的url
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);