2017-03-22 132 views
0

我在php codeigniter中發佈了一個問題,將數據從客戶端發佈到像下面這樣的服務器,並在服務器中用於通過file_get_contents(「php:/ /輸入「)。它截斷數據並只顯示前50個字符。它在我以前的服務器上工作正常,現在我們已經改變到新的服務器後,它得到一個問題。PHP file_get_contents(「php:// input」)缺少請求內容

var base_url = "http://www.mydomain.in/"; 
$.ajax({ 
      url:base_url+ "index.php/api/transactions/status", 
      data: {"username":"logimax","passwd":"[email protected]015","status":"Y"}, 
      dataType:"JSON", 
      type:"POST", 
      success:function(data){ 
       console.log(data); 
         }, 
         error:function(error) 
         { 
       console.log(err);  
         } 
      }); 

Firebug的報告: 我們可以監測後的數據,並在類似於下面的螢火蟲響應,

請求URL:http://www.mydomain.in/index.php/api/transactions/status 請求方法:POST

請求頭:接受:應用/ JSON ,text/javascript,

表格數據 用戶名:logimax passwd:pass @ 2015 stat我們:Y

響應: 串(50)「的用戶名= 1

在服務器 服務器端代碼:使用笨REST服務。

public function transactionsByStatus_post() 
{ 
    var_dump(file_get_contents('php://input')); // Its getting truncate. Not fully displaying the values. 

//Response sending as JSON Format 
} 
+0

是,爲什麼你讀你的輸入這樣的問題?爲什麼不使用'$ _POST'? – hassan

+0

print_r($ _ POST);它也返回截斷值。輸出看起來像Array ( [用戶名] –

+0

然後,檢查出你的php.ini選項'max_post_size'並增加它是一個足夠公平的; – hassan

回答

0

檢查您的php.ini中是否啓用了xdebug擴展。

如果是這樣,也許嘗試這些設置:

xdebug.var_display_max_data=-1 
xdebug.var_display_max_children=-1 
xdebug.var_display_max_depth=-1