2017-02-08 2 views
6

나는 json api addon을 가지고 있습니다. 결과를 데이터베이스에 저장하는 쿼리가 있지만 다른 시스템에서 다른 응답을줍니다. 이미 브라우저 쿠키 및 캐시를 지우지 만 아무 일도 발생하지 않습니다. 이 저장 장치 ID는 또 다시 심지어 이미 내 기능은 다음과 같다다른 브라우저에서 다른 응답

저장 : 여기

public function store_device_id() 
{ 
    global $wpdb; 
    $device_id = $_REQUEST['device_id']; 
    $device_type = $_REQUEST['device_type']; 
    $table_name = $wpdb->prefix . 'ws_details'; 
    if(!empty($device_id) && !empty($device_type)) : 
    $check = $wpdb->get_row("SELECT * FROM $table_name WHERE device_id like '%".$device_id."%'"); 
    if($check == '') 
    { 
     $result = $wpdb->insert($table_name,array( 
       'time' => current_time('mysql'), 
       'device_id' => $device_id, 
       'device_type' => $device_type), 
      array('%s', '%s', '%s')); 
     if ($result) 
     { 
      $res = 'Device id saved.'; 
     } else { 
      $res = 'Device id did not save.'; 
     } 
    } 
    else{ 
     $res = 'Device already register.'; 
    } 
else : 
    $res = 'Please enter device id & device type.'; 
endif; 

nocache_headers(); 
$post = new JSON_API_Post(); 
$post = $res; 
return array(
     'post' => $post 
    ); 
} 

는 NOT이 wp_ws_details ( id MEDIUMINT을 존재하는 경우 (테이블 만들기 테이블 구조

입니다 9) NULL이 아닌 AUTO_INCREMENT, device_id varchar (255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, device_type varchar (5) 5) utf8mb4_unicode_ci에게 NOT NULL DEFAULT ', time 날짜 NOT NULL DEFAULT "0000-00-00 0시 0분 0초' UNIQUE KEY id (id) ) ENGINE = 이노 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci AUTO_INCREMENT = 대조 1 ;

+0

어디에서이 API를 사용하고 있습니까? –

+0

android –

+0

에서 webservice에이 API를 사용하고 있습니다.이 where 절이 기기 ID 검색을 위해 작동하지 않습니다. 로그인을 변경 했으므로 임시이지만 해결책이 필요합니다. 도와주세요 .... –

답변

0

다른 브라우저에서 다른 응답을받는 경우 가장 확실한 캐싱 문제가 있으며 클라이언트 쪽입니다. nocache_headers()을 호출하지 않고 기능을 시험해보고 어떤 결과가 나오는지보십시오.

관련 문제