Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Can';t使用截取从我的数据库读取数据_Php_Kotlin_Android Volley - Fatal编程技术网

Php Can';t使用截取从我的数据库读取数据

Php Can';t使用截取从我的数据库读取数据,php,kotlin,android-volley,Php,Kotlin,Android Volley,所有的数据都可以通过PHP获得,但是当我尝试jsonArrayRequest时,它什么也不读取。也没有错误消息,就好像连连接都无法连接一样。我对这个很陌生 class HomeFragment : Fragment() {override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val v = inflater.infla

所有的数据都可以通过PHP获得,但是当我尝试jsonArrayRequest时,它什么也不读取。也没有错误消息,就好像连连接都无法连接一样。我对这个很陌生

class HomeFragment : Fragment() {override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    val v = inflater.inflate(R.layout.fragment_home, container, false)
    var url:String="http://192.168.43.181/ahmet.php"
    var datetime = ArrayList<String>()
    var temp = ArrayList<String>()
    var humid = ArrayList<String>()
    var h2o = ArrayList<String>()
    var ph = ArrayList<String>()
    var id = ArrayList<Int>()
    var errorMessage=""

    var rq: RequestQueue = Volley.newRequestQueue(v.context)
    var jar =JsonArrayRequest(Request.Method.GET,url, null,{
            response ->
            Toast.makeText(v.context, "here", Toast.LENGTH_SHORT).show()
            for(i in 0 until response.length()){
                datetime.add(response.getJSONObject(i).getString("dateandtime"))
                temp.add(response.getJSONObject(i).getInt("temp").toString())
                humid.add(response.getJSONObject(i).getInt("humid").toString())
                ph.add(response.getJSONObject(i).getInt("ph").toString())
                if(response.getJSONObject(i).getInt("h2o")==1){
                    h2o.add("On")
                }else{
                    h2o.add("Off")
                }
                id.add(response.getJSONObject(i).getInt("data_id"))
            }
    }, { error ->
            errorMessage= error.message.toString()
    })
    rq.add(jar)

    return v


 }
}
class HomeFragment:Fragment(){override fun onCreateView(充气机:布局充气机,容器:ViewGroup?,savedInstanceState:Bundle?):视图{
val v=充气机。充气(R.layout.fragment_home,容器,假)
变量url:字符串=”http://192.168.43.181/ahmet.php"
var datetime=ArrayList()
var temp=ArrayList()
var=ArrayList()
var h2o=ArrayList()
var ph=ArrayList()
var id=ArrayList()
var errorMessage=“”
var rq:RequestQueue=Volley.newRequestQueue(v.context)
var jar=JsonArrayRequest(Request.Method.GET,url,null{
答复->
Toast.makeText(v.context,“here”,Toast.LENGTH\u SHORT.show())
for(在响应.length()之前0中的i){
add(response.getJSONObject(i.getString(“dateandtime”))
temp.add(response.getJSONObject(i.getInt(“temp”).toString())
add(response.getJSONObject(i.getInt(“潮湿”).toString())
ph.add(response.getJSONObject(i.getInt(“ph”).toString())
if(response.getJSONObject(i.getInt(“h2o”)==1){
h2o.添加(“On”)
}否则{
h2o.添加(“关闭”)
}
id.add(response.getJSONObject(i).getInt(“数据_id”))
}
},{错误->
errorMessage=error.message.toString()
})
rq.add(jar)
返回v
}
}