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

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

WBOY
Release: 2016-06-13 12:48:41
Original
893 people have browsed it

请问怎么提取这个页面的汉字内容到数组?大侠帮帮忙啊
请问怎么提取这个页面的汉字内容到数组?谢谢
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);
Copy after login

Array
(
    [0] => 测试男女
    [1] => 测试排卵期试纸
    [2] => 测试仪
    [3] => 测试纸 早孕
    [4] => 测试钞
    [5] => 测试皮肤水分笔
    [6] => 测试皮肤水分
    [7] => 测试甲醛试纸
    [8] => 测试纸
    [9] => 测试卡
)
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template