Home  >  Article  >  Backend Development  >  请教如何提取这个页面的汉字内容到数组?大侠帮帮忙

请教如何提取这个页面的汉字内容到数组?大侠帮帮忙

WBOY
WBOYOriginal
2016-06-13 12:48:41868browse

请问怎么提取这个页面的汉字内容到数组?大侠帮帮忙啊
请问怎么提取这个页面的汉字内容到数组?谢谢
http://suggest.taobao.com/sug?extras=1&code=utf-8&callback=g_ks_suggest_callback&q=%E6%B5%8B%E8%AF%95


------解决方案--------------------
$s=file_get_contents('http://suggest.taobao.com/sug?extras=1&code=utf-8&callback=g_ks_suggest_callback&q=%E6%B5%8B%E8%AF%95');<br />
preg_match('/\{.+\}/',$s,$m);<br />
foreach(json_decode($m[0])->result as $v){<br />
     $arr[]=$v[0];<br />
}<br />
print_r($arr);

Array
(
    [0] => 测试男女
    [1] => 测试排卵期试纸
    [2] => 测试仪
    [3] => 测试纸 早孕
    [4] => 测试钞
    [5] => 测试皮肤水分笔
    [6] => 测试皮肤水分
    [7] => 测试甲醛试纸
    [8] => 测试纸
    [9] => 测试卡
)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn