• 技术文章 >后端开发 >php教程

    PHP制作百度词典查词采集器_PHP

    2016-05-31 13:17:37原创443

    百度dict 采集样本

    写的采集百度dict词典翻译后的所有结果数据,当然附带了13.5w单词库和采集简单的案例,这里我把写出的主要类dict.class.php放出来,项目地址http://github.com/widuu/baidu_dict,有需要的直接fork就可以了~么么哒,这东西用的人很少,所以有用的兄弟拿走了哈~

    <?php
    /**
     * dict.class.php 采集百度词典翻译内容
     *
     * @copyright      (C) 2014 widuu
     * @license       http://www.widuu.com
     * @lastmodify     2014-2-15
     */
     
     
    header("content-type:text/html;charset=utf8");
    class Dict{
    
    	private $word;
    	
    	//显示的条数
    	private static $num = 10;
    
    	public function __construct(){}
    	
    	
    	/**
       * 公用返回百度采集数据的方法
       * @param string 英文单词
       * retun array(
    	 *				symbol" => 音标
    	 *				"pro"	 => 发音
    	 *				"example"=> 例句
    	 *				"explain"=> 简明释义
    	 *				"synonym"=> 同反义词
    	 *				"phrase" => 短语数组
    	 *			)
       *
    	 */
    	public function content($word){
    		 $this -> word = $word;
    		 $symbol = $this -> Pronounced();
    		 $pro	 = $this->getSay();
    		 $example = $this -> getExample();
    		 $explain = $this -> getExplain();
    		 $synonym = $this -> getSynonym();
    		 $phrase = $this -> getPhrase();
    		 $result = array(
    				"symbol" => $symbol,		//音标
    				"pro"	 => $pro,			//发音
    				"example"=> $example,		//例句
    				"explain"=> $explain,		//简明释义
    				"synonym"=> $synonym,		//同反义词
    				"phrase" => $phrase 		//短语数组
    			);
    		return $result;
    	}
    
    
    	/**
       * 远程获取百度翻译内容
       * get function curl
       * retun string
       *
    	 */
    
    	private function getContent(){
     		$useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0";
     		$ch = curl_init();
     		$url = "http://dict.baidu.com/s?wd=".$this->word;
     		curl_setopt($ch, CURLOPT_URL, $url);
     		curl_setopt($ch, CURLOPT_USERAGENT,$useragent);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 
    		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    		curl_setopt($ch, CURLOPT_HTTPGET, 1);
    		curl_setopt($ch, CURLOPT_AUTOREFERER,1);
    		curl_setopt($ch, CURLOPT_HEADER, 0); 
    		curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    		$result = curl_exec($ch);
    		if (curl_errno($curl)) {
    			echo 'Errno'.curl_error($curl);
    		}
    		curl_close($ch);
    		return $result;
    	}
    
    
    	/**
       * 获取百度翻译发音
       * retun array(英,美)
       *
    	 */
    
    	private function Pronounced(){
    		$data = $this -> getContent();
    		preg_match_all("/\"EN\-US\"\>(.*)\<\/b\>/Ui",$data,$pronounced);
    		return array(
    			'en' => $pronounced[1][0],
    			'us' => $pronounced[1][1]
    		);
    	}
    
    	/**
    	 * 获取百度翻译发音
    	 * return array(英,美)
    	 *
    	 */
    
    	private function getSay(){
    		$data = $this -> getContent();
    		preg_match_all("/url=\"(.*)\"/Ui",$data,$pronounced);
    		return array(
    			'en' => $pronounced[1][0],
    			'us' => $pronounced[1][1]
    		);	
    	}
    
    	/**
       * 获取百度翻译例句
       * return array() 多维数组 例句
       * 
    	 */
    
    	private function getExample(){
    		$str = "";
    		$data = $this -> getContent();
    		preg_match_all("/var example_data = (.*)\]\;/Us",$data,$example);
    	  $data1 = "[[[".ltrim($example[1][0],"[");
    	  $data2 = explode("[[[",$data1);
    	  $num = count(array_filter($data2));
    		foreach($data2 as $key => $value){
    		 	$data3 = explode("[[","[[".$value);
    		 	foreach ($data3 as $k => $v) {
    		 		preg_match_all("/\[\"(.*)\",/Us","[".$v, $match);
    		 		if(!empty($match[1])){
    		 			$str .= implode($match[1]," ")."@";
    		 		}
    		 	}
    		}
    		$data4 = trim($str,"@");
    		$data5 = explode("@", $data4);
    		$result = array_chunk($data5, 2);
    		return $result;
    	}
    
    	/**
       * 获取简明释义
       * return array (x => "词性",b => "附属")
       * 
    	 **/
    
    	private function getExplain(){
    		$data = $this -> getContent();
    		preg_match_all("/id\=\"en\-simple\-means\"\>(.*)\/Us",$data,$explain);
    		$r_data = $explain[1][0];
    		preg_match_all("/\\(?P.*)\<\/strong\>\(?P.*)\<\/span\>\<\/p\>/Us", $r_data, $a_data);
    		preg_match_all("/\(?P[^\>]+)\:\(?P.*)\<\/a\>\<\/span\>/Us", $r_data, $b_data);
    		
    		$result = array();
    		foreach ($a_data["adj"] as $key => $value) {
    			$result[$value] = $a_data["name"][$key];
    		}
    		
    		$word_b = array();
    		foreach ($b_data["tag"] as $key => $value) {
    			$word_b[$value] = strip_tags($b_data["word"][$key]);
    		}
    		
    		$result_data = array("x" => $result,"b" => $word_b);
    
     		return $result_data;
    	}
    
    
    	/**
       * 获取同义词
       * return array(0 => "同义词", 1 => "反义词") 一般为多维数组
       * 
    	 */
    
    	private function getSynonym(){
    		$data = $this -> getContent();
    		preg_match_all("/id=\"en\-syn\-ant\"\>(.*)/Us",$data,$synonym);
    		$content = $synonym[1][0];
    		$data1 = explode("", $content);
    		$result = array();
    		$data2 = array();
    		foreach ($data1 as $key => $value) {
    			preg_match_all("/\(?P.*)\ \;\<\/strong\>\<\/div\>\\(?.*)\<\/ul\>/Us", $value, $r_data);
    			$data2[$key]["adj"] = $r_data["adj"];
    			$data2[$key]["content"] = $r_data["content"];
    		}
    
    		foreach ($data2 as $key => $value) {
    			foreach ($value["content"] as $k => $v) {
    				if(!empty($v)){
    					preg_match_all("/\\(?P.*)\<\/p\>(?P<value>.*)\<\/li>/Us", $v, $v_data);
    					foreach ($v_data['title'] as $m => $d) {
    						$data = strip_tags(preg_replace("<</a>>"," ", $v_data["value"][$m]));
    						$result[$key][$value["adj"][$k]][$d] = $data;
    					}
    				}
    			}
    		}
     		return $result;
    	}
    
    	/**
       * 获取短语词组
       * return array (key => value) 一维或者多维数组
       * 
    	 */
    
    	private function getPhrase(){
    		$num = self::$num;
    		$data = $this -> getContent();
    		preg_match_all("/id=\"en\-phrase\"\>(.*)\<div class\=\"source\"\>/Us",$data,$phrase);
    		$data = explode("</dd>",$phrase[1][0]);
    		$data1 = array_slice($data,0,$num);
    		$result = array();
    		foreach ($data1 as $key => $value) {
    			$data2 = explode("</p>", $value);
    			$n = count($data2);
    			if($n<=3){
    				$result[str_replace(" ","",strip_tags($data2[0]))] = strip_tags($data2[1]);
    			}else{
    				$data3 = array_slice($data2,0,$n-1);
    				$data4 = array_slice($data2,0,2);
    				$res = array_diff($data3,$data4);
    				$data5 = array_chunk($res,2);
    				$key_value = trim(str_replace(" ","",strip_tags($data4[0])));
    				$result[$key_value] = strip_tags($data4[1]);
    				foreach ($data5 as $key => $value) {
    					foreach ($value as $k => $v) {
    						$value[$k] = strip_tags($v);
    					}
    					$array = array($result[$key_value],$value);
    					if (array_key_exists($key_value, $result)){
    						$result[$key_value] = $array;
    					}
    				}
    				
    			}
    		}
    		return $result;
    	}
    
    	/**
    	 * 将数组转换为字符串
    	 *
    	 * @param  array  $data    数组
    	 * @param  bool  $isformdata 如果为0,则不使用new_stripslashes处理,可选参数,默认为1
    	 * @return  string 返回字符串,如果,data为空,则返回空
    	 */
    	private function array2string($data, $isformdata = 1) {
    	  if($data == '') return '';
    	  if($isformdata) $data = $this->new_stripslashes($data);
    	  return addslashes(var_export($data, TRUE));
    	}
    
    	/**
    	 * 返回经stripslashes处理过的字符串或数组
    	 * @param $string 需要处理的字符串或数组
    	 * @return mixed
    	 */
    	private function new_stripslashes($string) {
    	  if(!is_array($string)) return stripslashes($string);
    	  foreach($string as $key => $val) $string[$key] = $this->new_stripslashes($val);
    	  return $string;
    	}
    
    }
    
    // $word = new dict("express");
    // $word ->content();</pre>
    </p>
    <p>以上就是本文的全部内容了,非常实用的功能,希望小伙伴们能够喜欢。<div class='bg-white layui-clear' style="margin:15px 0;"><span style="color:red;">声明:</span>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。</div><div class='tags bg-white layui-clear pt-5'><span>专题推荐:</span><a href="//m.sbmmt.com/m/search?word=php" target="_blank">php</a> <a href="//m.sbmmt.com/m/search?word=采集" target="_blank">采集</a> <a href="//m.sbmmt.com/m/search?word=百度词典" target="_blank">百度词典</a></div><script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js"></script><div class="wwads-cn wwads-horizontal" data-id="156" style="max-width:640px"></div><div><span style="display:inline-block; width: 100%; margin-top: 10px;">
    			   上一篇:<a style="color: #00AEEF;" href="//m.sbmmt.com/m/article/54214.html">PHP实现返回JSON和XML的类分享_PHP</a></span><span style="display:inline-block; width: 100%">
    			   下一篇:<a style="color: #00AEEF;" href="//m.sbmmt.com/m/article/54216.html">php上传文件问题汇总_PHP</a></span></div></article><!--<div class="selectButton"><button type="button">点击阅读全文</button></div>--><!--<a href="javascript:;" onclick="location.href='https://m.xp.cn/'" rel="nofollow"><img src="//m.sbmmt.com/m/static/images/articlead.jpg" width="100%" alt="phpstudy集成环境下载"></a>--><a href="//m.sbmmt.com/m/course/1413.html" rel="nofollow"><img src="//m.sbmmt.com/img/upload/course/000/000/071/627b97145319f588.png" width="100%" alt="千万级数据并发解决方案"></a><!--<a href="//m.sbmmt.com/m/vip_mobile.html" rel="nofollow"><img src="//m.sbmmt.com/m/static/images/articlead1.gif" width="100%" alt="会员特权"></a>--></div><div class='course-list bg-white layui-clear mt-10'><h4>相关文章推荐</h4><a href='//m.sbmmt.com/m/article/56692.html' title="php实现批量下载百度云盘文件例子分享_PHP" class='alist'>• php实现批量下载百度云盘文件例子分享_PHP</a><a href='//m.sbmmt.com/m/article/56980.html' title="php命名空间学习详解_PHP" class='alist'>• php命名空间学习详解_PHP</a><a href='//m.sbmmt.com/m/article/57890.html' title="解析如何屏蔽php中的phpinfo()函数_PHP" class='alist'>• 解析如何屏蔽php中的phpinfo()函数_PHP</a><a href='//m.sbmmt.com/m/article/58226.html' title="php对大文件进行读取操作的实现代码_PHP" class='alist'>• php对大文件进行读取操作的实现代码_PHP</a><a href='//m.sbmmt.com/m/article/59112.html' title="php设计模式  Command(命令模式)_PHP" class='alist'>• php设计模式  Command(命令模式)_PHP</a></div><div class='course-list bg-white layui-clear mt-10 mb-30'><ul ><h4>相关课程推荐</h4><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/386.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/001/5d1c6df423564706.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/386.html">独孤九贱(3)_JavaScript视频教程</a></h2><p class='course-intro-info'>javascript是运行在浏览器上的脚本语言,连续多年,被评为全球最受欢迎的编程语言。是前端开发必备三大法器中,最具杀伤力。如果前端开发是降龙十八掌,好么javascript就是第18掌:亢龙有悔。没有它,你的前端生涯是不完整的。《php.cn独孤九贱(3)-JavaScript视频教程》课程特色:php中文网原创幽默段子系列课程,以恶搞,段子为主题风格的php视频教程!轻松的教学风格,简短的教学模式,让同学们在不知不觉中,学会了javascript知识。</p><p><a href="//m.sbmmt.com/m/course/list/17.html"><span class='level'>JavaScript教程</span></a><span class='count'>124603次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/582.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/001/5d1c6e0d2b744633.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/582.html">独孤九贱(6)_jQuery视频教程</a></h2><p class='course-intro-info'>jQuery是一个快速、简洁的JavaScript框架。设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。它封装JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、动画设计和Ajax交互。
    核心特性可以总结为:具有独特的链式语法和短小清晰的多功能接口;具有高效灵活的css选择器,并且可对CSS选择器进行扩展;拥有便捷的插件扩展机制和丰富的插件。兼容各种主流浏览器,如IE 6.0+、FF 1.5+、Safari 2.0+、Opera 9.0+等,是全球最流行的前端开发框架之一。PHP中文网根据最新版本,独家录制jQuery最新视频教程,回馈PHP中文网的新老用户。</p><p><a href="//m.sbmmt.com/m/course/list/19.html"><span class='level'>jQuery教程</span></a><span class='count'>103033次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/1195.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/015/612f16c1e1c8e978.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/1195.html">jQuery与Ajax基础与实战</a></h2><p class='course-intro-info'>jQuery是最流行的JS函数库,封装了许多实用的功能,其中最引人入胜的就是Ajax。
    jQuery中的Ajax操作,语法简单,操作方便,使Ajax从未如此轻松,前端人员从此不再为与服务器异步交互而发愁,本套课程,精选了最常用的几个方法,从基本的语法到每个参数,再到具体实例进行了全面的讲解。</p><p><a href="//m.sbmmt.com/m/course/list/25.html"><span class='level'>AJAX教程</span></a><span class='count'>4285次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/1313.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/015/617b8f8af2b97409.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/1313.html">Git教程(60分钟全程无废话版)</a></h2><p class='course-intro-info'>Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。
    Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。
    Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持</p><p><a href="//m.sbmmt.com/m/course/list/17.html"><span class='level'>JavaScript教程</span></a><span class='count'>3624次播放</span></p></div></li><hr></ul></div><!--
    <div class='discuss layui-clear bg-white'><h3>全部评论<span id='discuss-article'>我要评论</span></h3></div><div class='discuss-submit bg-white' url="//m.m.sbmmt.com/"><li class='info layui-clear'><span class='f-left' id='discuss-submit-close'>取消</span><span class='f-left'>发布评论</span><span class='f-right article-reply-publish' id="54215">发送</span></li><li class='layui-clear'><textarea type='text' rows="6" placeholder="请输入要评论的内容" class="article-reply-content-text"></textarea></li><li class='layui-clear'><button class="layui-btn layui-btn-danger f-right article-reply-publish-button">发布</button></li></div>--><div class='lock-screen' id='lock-screen'></div><div class='popimg-setting'><div>1/1</div><img src="" width='100%'></div><script src="//m.sbmmt.com/m/static/ueditor/third-party/SyntaxHighlighter/shCore.js"></script><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><footer><a href='//m.sbmmt.com/m/' ><i class='layui-icon layui-icon-home '></i>首页</a><a href='//m.sbmmt.com/m/course.html' ><i class='layui-icon layui-icon-play'></i>视频</a><a href='//m.sbmmt.com/m/mq.html?t=2'><img src="//m.sbmmt.com/m/static/images/gif_live.gif" />直播</a><!--	<a href='//m.sbmmt.com/m/app/'><img src="//m.sbmmt.com/img/upload/article/000/000/003/6108e2ad07387877.png" style="width:20px;height:20px;" /><div style="margin-top:-5px;">下载</div></a>--><a href='//m.sbmmt.com/m/wenda.html' ><i class='layui-icon layui-icon-code-circle'></i>社区</a><a href='//m.sbmmt.com/m/login' ><i class='layui-icon layui-icon-username'></i>我的</a></footer><div class="headerMask"></div><div class="right_menu"><div class="right_menu_con"><h2 class="hjclass-txt"><i class="layui-icon layui-icon-shrink-right hjclass-txt-i"></i>PHP中文网</h2><div class="menu-list"><a href="//m.sbmmt.com/m/"><span class="item-icon item-1"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb65f99ae2304.png" alt="首页"></span> 首页</a><a href="//m.sbmmt.com/m/course.html"><span class="item-icon item-7"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb82bd09ad628.png" alt="课程"></span> 课程</a><a href="//m.sbmmt.com/m/article.html"><span class="item-icon item-4"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb7e111b3b425.png" alt="文章"></i></span>文章</a><a href="//m.sbmmt.com/m/wenda.html"><span class="item-icon item-2"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb83f04e24328.png" alt="问答"></span> 问答</a><a href="//m.sbmmt.com/m/blog.html"><span class="item-icon item-0"><img src="//m.sbmmt.com/m/static/images/ico/blog.png" alt="博客"></span>博客</a><a href="//m.sbmmt.com/m/dic.html"><span class="item-icon item-9"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb85047b25758.png" alt="词典"></span> 词典</a><a href="//m.sbmmt.com/m/course/type/99.html"><span class="item-icon item-3"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb8736ea90300.png" alt="手册"></span> 手册</a><a href="//m.sbmmt.com/m/xiazai/"><span class="item-icon item-5"><img src="//m.sbmmt.com/m/static/images/ico/resources.png" alt="资源"></span> 资源</a><a href="//m.sbmmt.com/m/search"><span class="item-icon item-6"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb880b460a204.png" alt="搜索"></span> 搜索</a><a href="//m.sbmmt.com/m/app/"><span class="item-icon item-6"><img src="//m.sbmmt.com/img/upload/article/000/000/003/608bbfa30d9cc398.png" style="width:35px;height:35px;" alt="APP下载"></span> APP下载</a></div></div></div><script>isLogin = 0;</script><script type="text/javascript" src="//m.sbmmt.com/m/static/js/jquery.min.js"></script><script type="text/javascript" src="//m.sbmmt.com/m/static/layui/layui.js"></script><script type="text/javascript" src="//m.sbmmt.com/m/static/js/global.js?4.9.47"></script><script>(function () {var bp = document.createElement('script');var curProtocol = window.location.protocol.split(':')[0];if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';} else {bp.src = 'http://push.zhanzhang.baidu.com/push.js';}var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(bp, s);})();var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "https://m.sbmmt.com/hm.js?43f47cabf6856204df6d083dd89ae407";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script><link rel='stylesheet' id='_main-css' href='//m.sbmmt.com/m/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='//m.sbmmt.com/m/static/js/viewer.min.js?1'></script><script type='text/javascript' src='//m.sbmmt.com/m/static/js/jquery-viewer.min.js'></script><script>
    // function called if wwads is blocked
    function ABDetected() {
      document.getElementsByClassName("wwads-cn")[0].insertAdjacentHTML("beforeend", "<style>.wwads-horizontal,.wwads-vertical{background-color:#f4f8fa;padding:5px;min-height:120px;margin-top:20px;box-sizing:border-box;border-radius:3px;font-family:sans-serif;display:flex;min-width:150px;position:relative;overflow:hidden;}.wwads-horizontal{flex-wrap:wrap;justify-content:center}.wwads-vertical{flex-direction:column;align-items:center;padding-bottom:32px}.wwads-horizontal a,.wwads-vertical a{text-decoration:none}.wwads-horizontal .wwads-img,.wwads-vertical .wwads-img{margin:5px}.wwads-horizontal .wwads-content,.wwads-vertical .wwads-content{margin:5px}.wwads-horizontal .wwads-content{flex:130px}.wwads-vertical .wwads-content{margin-top:10px}.wwads-horizontal .wwads-text,.wwads-content .wwads-text{font-size:14px;line-height:1.4;color:#0e1011;-webkit-font-smoothing:antialiased}.wwads-horizontal .wwads-poweredby,.wwads-vertical .wwads-poweredby{display:block;font-size:11px;color:#a6b7bf;margin-top:1em}.wwads-vertical .wwads-poweredby{position:absolute;left:10px;bottom:10px}.wwads-horizontal .wwads-poweredby span,.wwads-vertical .wwads-poweredby span{transition:all 0.2s ease-in-out;margin-left:-1em}.wwads-horizontal .wwads-poweredby span:first-child,.wwads-vertical .wwads-poweredby span:first-child{opacity:0}.wwads-horizontal:hover .wwads-poweredby span,.wwads-vertical:hover .wwads-poweredby span{opacity:1;margin-left:0}.wwads-horizontal .wwads-hide,.wwads-vertical .wwads-hide{position:absolute;right:-23px;bottom:-23px;width:46px;height:46px;border-radius:23px;transition:all 0.3s ease-in-out;cursor:pointer;}.wwads-horizontal .wwads-hide:hover,.wwads-vertical .wwads-hide:hover{background:rgb(0 0 0 /0.05)}.wwads-horizontal .wwads-hide svg,.wwads-vertical .wwads-hide svg{position:absolute;left:10px;top:10px;fill:#a6b7bf}.wwads-horizontal .wwads-hide:hover svg,.wwads-vertical .wwads-hide:hover svg{fill:#3E4546}</style><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-img' target='_blank' rel='nofollow'><img src='https://creatives-1301677708.file.myqcloud.com/images/placeholder/wwads-friendly-ads.png' width='130'></a><div class='wwads-content'><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-text' target='_blank' rel='nofollow'>为了本站的长期运营,请将我们的网站加入广告拦截器的白名单,感谢您的支持!</a><a href='https://wwads.cn/page/end-user-privacy' class='wwads-poweredby' title='万维广告 ~ 让广告更优雅,且有用' target='_blank'><span>万维</span><span>广告</span></a></div><a class='wwads-hide' onclick='parentNode.remove()' title='隐藏广告'><svg xmlns='http://www.w3.org/2000/svg' width='6' height='7'><path d='M.879.672L3 2.793 5.121.672a.5.5 0 11.707.707L3.708 3.5l2.12 2.121a.5.5 0 11-.707.707l-2.12-2.12-2.122 2.12a.5.5 0 11-.707-.707l2.121-2.12L.172 1.378A.5.5 0 01.879.672z'></path></svg></a>");
    };
    
    //check document ready
    function docReady(t) {
        "complete" === document.readyState ||
        "interactive" === document.readyState
          ? setTimeout(t, 1)
          : document.addEventListener("DOMContentLoaded", t);
    }
    
    //check if wwads' fire function was blocked after document is ready with 3s timeout (waiting the ad loading)
    docReady(function () {
      setTimeout(function () {
        if( window._AdBlockInit === undefined ){
            ABDetected();
        }
      }, 3000);
    });
    </script><script>$('article').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}});</script><script type="application/ld+json">{"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld","@id": "//m.m.sbmmt.com/article/54215.html","appid": "1549852514326010","title": "PHP制作百度词典查词采集器_PHP","images": ["http://img.bitscn.com/upimg/allimg/c150209/14234Sa454E0-11418.jpg"],"description": "这篇文章主要介绍了PHP制作百度词典查词采集器的相关资料,需要的朋友可以参考下","pubDate": "2016-05-31T13:17:37","data": {"WebPage": {"headline": "PHP制作百度词典查词采集器_PHP","wapUrl": "//m.m.sbmmt.com/article/54215.html","pcUrl": "//m.sbmmt.com/m/php-weizijiaocheng-54215.html","fromSrc": "php中文网","domain": "电子科技","category": ["问答"],"isDeleted": 0},"Question": [{"acceptedAnswer":"这篇文章主要介绍了PHP制作百度词典查词采集器的相关资料,需要的朋友可以参考下"}],"ImageObject": [{"contentUrl": "http://img.bitscn.com/upimg/allimg/c150209/14234Sa454E0-11418.jpg","scale": "5:2"}],"Author": [{"name": "php中文网","jobTitle": ["php公益学习平台"],"headPortrait": "https://img.php.cn/upload/article/000/000/003/5d1b23156bf94358.png"}]}}</script><script>$('.selectButton').hide();</script><script>
        var href = window.location.href;
        var title = document.title;
        var num = Math.floor(Math.random() * 10000 + 1);
        var newscript = document.createElement('script');
        newscript.setAttribute('type','text/javascript');
        newscript.setAttribute('src',"https://analyze.xm6wpp.com/index.php/api/statistics/phpcn?url="+encodeURIComponent(href)+"&title="+encodeURIComponent(title)+"&"+num);
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(newscript);
    </script></body></html>