Home  >  Article  >  Backend Development  >  透過php傳直給android並轉換字串問題,该怎么处理

透過php傳直給android並轉換字串問題,该怎么处理

WBOY
WBOYOriginal
2016-06-13 11:21:351025browse

透過php傳直給android並轉換字串問題
我目前是透過php作為媒介,讀取遠端主機的mySQL資料
並且再將值回傳給android做顯示
在本機端的php做測試都很正常
也能正確抓到值並回傳
但是將php改成放於遠端的php時
卻會報錯:Value  of type java.lang.String cannot be converted to JSONArray

想請問問題是出在哪呢?ˊˋ
本機端與遠端主機的php路徑 檔名都是一樣的
mySQL的名稱和資料表也全部都一樣
但連遠端主機時卻會報錯
如附圖所示
這是在本機端時正確的logcat:


------解决方案--------------------
你最好给出链接地址给我看看
如果不方便,或不在公网上
那么你可以这样
echo base64_encode(file_get_contents('链接地址'));
贴出结果
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn