php获取淘宝分类id示例_PHP
程序员文章站
2024-02-06 15:28:16
...
复制代码 代码如下:
$url = "http://list.taobao.com/browse/cat-0.htm";
$html = file_get_contents($url);
echo '';
$pattern='/\(.*?)\/';
preg_match_all($pattern, $html, $array, PREG_SET_ORDER);
foreach($array as $item) {
echo $item[1] . "=>" . mb_convert_encoding($item[2], 'UTF-8', 'GB2312');
echo "
";
}
$url = "http://list.taobao.com/browse/cat-0.htm";
$html = file_get_contents($url);
echo '';
$pattern='/\(.*?)\/';
preg_match_all($pattern, $html, $array, PREG_SET_ORDER);
foreach($array as $item) {
echo $item[1] . "=>" . mb_convert_encoding($item[2], 'UTF-8', 'GB2312');
echo "
";
}
上一篇: php多文件打包下载的两种方法实例
下一篇: PHP的PDO以次这个程序为什么会出错