Php 如何知道新记录被检索到JSONArray中?

Php 如何知道新记录被检索到JSONArray中?,php,android,Php,Android,我想把JSONArray从Android发布到webserver;JSONArray包含来自Android的SQLite数据库表的记录: JSONObject parameters = new JSONObject(); parameters.put("jsonArray", new JSONArray(Arrays.asList(makeJSON()))); parameters.put("type", "Android");

我想把
JSONArray
Android
发布到
webserver
JSONArray
包含来自
Android
SQLite
数据库表的
记录:

JSONObject parameters = new JSONObject();
            parameters.put("jsonArray", new JSONArray(Arrays.asList(makeJSON())));
            parameters.put("type", "Android");
            URL url = new URL(myurl);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty( "Content-Type", "application/json" );
            conn.setDoOutput(true);
            conn.setRequestMethod("POST");
            OutputStream out = new BufferedOutputStream(conn.getOutputStream());
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
            writer.write(parameters.toString());
            writer.close();
            out.close();
方法makeJSON:

if(mCur != null && mCur.moveToFirst()){ // method makeJSON() retrieving database records
            do{
                try{
                    JSONObject jObj = new JSONObject(); 
                    String notificationDateFor = mCur.getString(mCur.getColumnIndexOrThrow("NotificationDateFor")); 
                    String typeNotification =  mCur.getString(mCur.getColumnIndexOrThrow("TypeNotification"));
                    String dob = mCur.getString(mCur.getColumnIndexOrThrow("DOB"));
                    String friendsName = mCur.getString(mCur.getColumnIndexOrThrow("FriendsName"));
                    String imageUri =  mCur.getString(mCur.getColumnIndexOrThrow("imageUri"));

                    jObj.put("NotificationDateFor", notificationDateFor); 
                    jObj.put("DOB", dob); 
                    jObj.put("TypeNotification", typeNotification);
                    jObj.put("FriendsName", friendsName); 
                    jObj.put("imageUri", imageUri);
                    jArr.put(jObj); 

                }catch(Exception e){
                    System.out.println("Exception: "+e);
                }
            }while(mCur.moveToNext());

        }
        return jArr;
PHP脚本:

$jsonArray = stripslashes($_POST['jsonArray']);

foreach ($jsonArray as $obj) {
   ... // how to know if a new record is being treated ?
}

在PHP脚本中,如何知道我是否正在处理新记录?因为我想插入/更新JSONArray中的每条记录。

通过回显来查看数据是否已发布,如下所示:

$jsonArray = stripslashes($_POST['jsonArray']);

 foreach ($jsonArray as $k=>$v) {
  echo $k . ' - ' . $v . '<br>';
}
$jsonArray=stripslashes($\u POST['jsonArray']);
foreach($jsonArray作为$k=>$v){
回音$k.'-'.$v.
'; }