最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

post请求php报500错误,php

互联网 admin 55浏览 0评论

post请求php报500错误,php

我在我的项目中使用Volley库并获得Unexpected response code 500作为响应。

我已经彻底搜索了stackoverflow,仍然无法找到有效的解决方案。

以下是我的POST字符串请求代码

val API = ".php"

val requestQueue = Volley.newRequestQueue(mActivity)

val stringRequest = StringRequest(

Request.Method.GET,

API,

Response.Listener { response ->

Log.i("dxdiag", response)

mView.onFetchHttpDataResult(true)

Toast.makeText(context, response, Toast.LENGTH_LONG).show()

},

Response.ErrorListener { error ->

Toast.makeText(context, error.toString(), Toast.LENGTH_LONG).show()

Log.i("dxdiag", error.printStackTrace().toString())

mView.onFetchHttpDataResult(false)

})

requestQueue.add(stringRequest)

以下是堆栈跟踪

2019-09-03 17:15:53.237 3308-3892/com.squadtechs.markhor.foodapp

E/Volley: [194] BasicNetwork.performRequest: Unexpected response code

500 for

.php

2019-09-03 17:15:53.243 3308-3351/com.squadtechs.markhor.foodapp

D/EGL_emulation: eglMakeCurrent: 0xa7d84180: ver 2 0 (tinfo

0xa7d832b0)

2019-09-03 17:15:53.256 3308-3308/com.squadtechs.markhor.foodapp

W/System.err: com.android.volley.ServerError

2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp

W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:205)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

以下是我在服务器端编写的PHP代码:

require 'db.php';

$sql = "SELECT * FROM `company_profile`";

$result = $con->query($sql);

if ($result->num_rows > 0) {

// output data of each row

while($row = $result->fetch_assoc()) {

$id=$row['id'];

$company_name=$row['company_name'];

$cuisine=$row['cuisine'];

$conpany_phone=$row['conpany_phone'];

$company_description=$row['company_description'];

$company_logo=$row['company_logo'];

$company_type=$row['company_type'];

$delivery_type=$row['delivery_type'];

$delivery_range=$row['delivery_range'];

$delivery_fee=$row['delivery_fee'];

$delivery_pickupinfo=$row['delivery_pickupinfo'];

$address=$row['address'];

$companyData[] = array('id'=> $id,'company_name'=>

$company_name,'cuisine'=> $cuisine,'conpany_phone'=>

$conpany_phone,'company_description'=>

$company_description,'company_logo'=> $company_logo,'company_type'=>

$company_type,'delivery_type'=> $delivery_type,'delivery_range'=>

$delivery_range,'delivery_fee'=>

$delivery_fee,'delivery_pickupinfo'=> $delivery_pickupinfo,'address'=> $address);

}

echo $jsonformat=json_encode($companyData);

} else {

echo "0 results";

}

$conn->close();

?>

post请求php报500错误,php

我在我的项目中使用Volley库并获得Unexpected response code 500作为响应。

我已经彻底搜索了stackoverflow,仍然无法找到有效的解决方案。

以下是我的POST字符串请求代码

val API = ".php"

val requestQueue = Volley.newRequestQueue(mActivity)

val stringRequest = StringRequest(

Request.Method.GET,

API,

Response.Listener { response ->

Log.i("dxdiag", response)

mView.onFetchHttpDataResult(true)

Toast.makeText(context, response, Toast.LENGTH_LONG).show()

},

Response.ErrorListener { error ->

Toast.makeText(context, error.toString(), Toast.LENGTH_LONG).show()

Log.i("dxdiag", error.printStackTrace().toString())

mView.onFetchHttpDataResult(false)

})

requestQueue.add(stringRequest)

以下是堆栈跟踪

2019-09-03 17:15:53.237 3308-3892/com.squadtechs.markhor.foodapp

E/Volley: [194] BasicNetwork.performRequest: Unexpected response code

500 for

.php

2019-09-03 17:15:53.243 3308-3351/com.squadtechs.markhor.foodapp

D/EGL_emulation: eglMakeCurrent: 0xa7d84180: ver 2 0 (tinfo

0xa7d832b0)

2019-09-03 17:15:53.256 3308-3308/com.squadtechs.markhor.foodapp

W/System.err: com.android.volley.ServerError

2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp

W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:205)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)2019-09-03 17:15:53.257 3308-3308/com.squadtechs.markhor.foodapp W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

以下是我在服务器端编写的PHP代码:

require 'db.php';

$sql = "SELECT * FROM `company_profile`";

$result = $con->query($sql);

if ($result->num_rows > 0) {

// output data of each row

while($row = $result->fetch_assoc()) {

$id=$row['id'];

$company_name=$row['company_name'];

$cuisine=$row['cuisine'];

$conpany_phone=$row['conpany_phone'];

$company_description=$row['company_description'];

$company_logo=$row['company_logo'];

$company_type=$row['company_type'];

$delivery_type=$row['delivery_type'];

$delivery_range=$row['delivery_range'];

$delivery_fee=$row['delivery_fee'];

$delivery_pickupinfo=$row['delivery_pickupinfo'];

$address=$row['address'];

$companyData[] = array('id'=> $id,'company_name'=>

$company_name,'cuisine'=> $cuisine,'conpany_phone'=>

$conpany_phone,'company_description'=>

$company_description,'company_logo'=> $company_logo,'company_type'=>

$company_type,'delivery_type'=> $delivery_type,'delivery_range'=>

$delivery_range,'delivery_fee'=>

$delivery_fee,'delivery_pickupinfo'=> $delivery_pickupinfo,'address'=> $address);

}

echo $jsonformat=json_encode($companyData);

} else {

echo "0 results";

}

$conn->close();

?>

发布评论

评论列表 (0)

  1. 暂无评论