1

我正在尝试了解动态分页的高音扬声器结果的 max_id。

搜索元数据如下:

search_metadata: {
  completed_in: 0.033,
  max_id: 326811859678277600,
  max_id_str: "326811859678277634",
  next_results: "?max_id=326811400389406719&q=%23helloworld&count=10&include_entities=1",
  query: "%23helloworld",
  refresh_url: "?since_id=326811859678277634&q=%23helloworld&include_entities=1",
  count: 10,
  since_id: 0,
  since_id_str: "0"
}

我的脚本将max_id下一个结果转换为 php 值会非常方便。

因此有没有办法从字符串中提取数字326811400389406719(以及任何其他类似的数字??max_id=326811400389406719&q=%23helloworld&count=10&include_entities=1

谢谢!

4

2 回答 2

3
$str = "?max_id=326811400389406719&q=%23helloworld&count=10&include_entities=1"    
parse_str($str, $output);
$max_id = $output['?max_id'];
//print_r($output);
于 2013-04-27T00:04:47.920 回答
2

常用表达?

$string = '?max_id=326811400389406719&q=%23helloworld&count=10&include_entities=1';

preg_match('/max_id=(\d+)/', $string, $matches);
$max_id = $matches[1];
于 2013-04-26T23:50:48.627 回答