我试图从我的database
商店获得纬度和经度,但当我试图在我的Android应用程序上获得JSON response
时,我得到了error
:
com.android.volley.ParseError: org.json.JSONException: Value <html> of type java.lang.String cannot be converted to JSONArray
这是我的PHP文件中的JSON
:http://comparateur.16mb.com/ShopGet.php
[{"id":"1","nom":"Leclerc LE KREMLIN ","marque":"Leclerc","adressemag":"106 Avenue DE FONTAINEBLEAU 94276 LE KREMLIN BICETRE CEDEX ","latitude":"48.809081","longitude":"2.362206","lundi":"8h30 - 21h","mardi":"8h30 - 21h","mercredi":"8h30 - 21h","jeudi":"8h30 - 21h","vendredi":"8h30 - 21h","samedi":"8h30 - 21h","dimanche":"8h30 - 13h"},{"id":"2","nom":"Leclerc PANTIN","marque":"Leclerc","adressemag":"51 Avenue JEAN LOLIVE BP 64 ZAC ILOT 93503 PANTIN CEDEX ","latitude":"48.891099","longitude":"2.401926","lundi":"9h - 20h30","mardi":"9h - 20h30","mercredi":"9h - 20h30","jeudi":"9h - 20h30","vendredi":"9h - 20h30","samedi":"9h - 20h30","dimanche":"Ferme"}]
是的,你必须在android端的url末尾添加".php",或者在服务器端配置htaccess。
对于htaccess:将.php URL重定向到不带扩展名的URL
您得到了错误的url,请在url中添加.php。
您使用的是http://comparateur.16mb.com/ShopGet
,但它应该是http://comparateur.16mb.com/ShopGet.php