- PHP code
<?php $baidu = file_get_contents("http://www.baidu.com/s?wd=site:www.baidu.com"); preg_match('/找到相关结果数(.+)个/', $baidu, $baidu_site_num); print_r($baidu_site_num); ?>
为什么匹配不到结果呢? 求解
该怎么写呢
------解决方案--------------------
文件编码先弄成UTF-8
<?php $baidu = file_get_contents("http://www.baidu.com/s?wd=site:www.baidu.com"); preg_match('/找到相关结果数(.+)个/', $baidu, $baidu_site_num); print_r($baidu_site_num); ?>