我正在开发一个android应用程序,我使用php/doctrine从数据库中检索数据。我把这些数据放在一个json对象中。使用json在php和android之间进行链接
问题是我不知道如何在android上显示它。 这是PHP代码:
function getTransaction($id) {
$transaction = $this->getDoctrine()
->getRepository('nameBundle:Transaction')
->find($id);
if(!$transaction) {
throw $this->createNotFoundException('No transaction found'.$id);
}
$array = $transaction->toArray();
$json = json_encode($array);
}
查看我已经回答的问题[这里] [1]你可以通过这个例子来实现。 [1]:http://stackoverflow.com/a/22558535/3360307 –
http://www.androidhive.info/2012/05/how-to-connect-android-with-php- mysql/ –
基本上这个教程是你想要的。保存你一个点击http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ –