正则表达式
http://bbs.10jqka.com.cn/codelist.html
preg_match_all('/<li><a[^>]+>(.+)<\/a><\/li>/isU',$s,$m);print_r($m[1]);
$str=<<<STR<li><a href="http://bbs.10jqka.com.cn/sh,600000,1" target="_blank" title="浦发银行">浦发银行 600000</a></li><li><a href="http://bbs.10jqka.com.cn/sh,600004,1" target="_blank" title="白云机场">白云机场 600004</a></li>STR; preg_match_all("/(\S+)\s+(\d+)/",preg_replace("/<\/?[^>]+?>/",'',$str),$out,PREG_SET_ORDER); foreach($out as $a) list($s,$o[$i],$i)=$a;print_r($o);
<?php$url ="http://bbs.10jqka.com.cn/codelist.html";$str = file_get_contents($url);preg_match_all('/<li><a[^>]+>([^\d]+)(\d{6})<\/a><\/li>/isU',$str,$match);$a = array_combine(array_values($match[2]),array_values($match[1]));print_r($a);
<?php$url ="http://bbs.10jqka.com.cn/codelist.html";$str = file_get_contents($url);preg_match_all('/<li><a[^>]+>([^\d]+)(\d{6})<\/a><\/li>/isU',$str,$match);$a = array_combine(array_values($match[2]),array_values($match[1]));print_r($a);
$url ="http://bbs.10jqka.com.cn/codelist.html";
$str = file_get_contents($url);
$str = iconv('gbk', 'utf-8', $str);
preg_match_all('/
$url ="http://bbs.10jqka.com.cn/codelist.html";
$str = file_get_contents($url);
$str = iconv('gbk', 'utf-8', $str);
preg_match_all('/
$url ="http://bbs.10jqka.com.cn/codelist.html";
$str = file_get_contents($url);
$str = iconv('gbk', 'utf-8', $str);
preg_match_all('/
也就是只要深市和沪市的数据,基金的不要
preg_match_all('/
preg_match_all('/