duansai1314 2015-03-16 13:39
浏览 57
已采纳

从parse.com获取数据时添加orderby子句

I am tryng to fetch data from parse.com but its not allow to skip more than 10000 data so for doing it in a alternate way i have to use order by

My code is

$request = 'skip='.$max.'&limit=1000';

$url = "https://api.parse.com/1/classes/_Installation" . "?".$request;
// $ch = curl_init($url); 
curl_setopt($ch,CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);  
$response = curl_exec($ch);  

$parse_data=json_decode($response,true);

I'm trying to use this concept https://www.parse.com/questions/paging-through-more-than-10000-results

but i don't know how to use orderby in curl code.

please help

  • 写回答

1条回答 默认 最新

  • dongteng2534 2015-03-16 14:06
    关注

    As API docs say:

    You can sort by multiple fields by passing order a comma-separated list. To retrieve documents that are ordered by scores in ascending order and the names in descending order:

    Example for you:

    $request = 'skip='.$max.'&limit=1000&order=your_order_field';
    

    You can choose if order should be ascending or descending by adding -:

    $request = 'skip='.$max.'&limit=1000&order=your_order_field';//ASC
    $request = 'skip='.$max.'&limit=1000&order=-your_order_field';//DESC
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退