新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

PHP怎么实现搜索引擎类

小编给大家分享一下PHP怎么实现搜索引擎类,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

成都创新互联公司专业为企业提供富川网站建设、富川做网站、富川网站设计、富川网站制作等企业网站建设、网页设计与制作、富川企业网站模板建站服务,十年富川做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

PHP搜索引擎类1.类文件:

  1. class grabble{  

  2. var $filename;  

  3. var $html;  

  4. var $urls = array(); //url历史  

  5. var $url ;  

  6. var $url_1;  

  7. function grabble(){  

  8. set_time_limit(3600);   

  9. }  

  10. function set($_filename){  

  11. $this->filename = $_filename;  

  12. array_push ($this->url, $_filename);   

  13. }//end.set;  

  14. function set_url($_url){  

  15. eregi('(^http://.*[^/]).*' , $_url , $array);  

  16. $this->url = $array[1] . "/";   

  17. eregi('(^http://.*[^/]).*' , $_url , $array);  

  18. //print_r($array);  

  19. $this->url_1 = $array[1];  

  20. }  

  21. function get(){  

  22. }//end.get;  

  23. function get_html($_filename=null){  

  24. $this->filename = $_filename;  

  25. $this->html = @implode('', file($_filename)) ;  

  26. return $this->html;  

  27. }//end.get_html;  

  28. function get_title($_str=null){  

  29. preg_match_all("/</strong>(.*)<strong><</strong>\/title<strong>><br/></strong>/Uis", $_str, $matches);  </p></li><li><p>return $matches[1][0];  </p></li><li><p>}//end.get_title;  </p></li><li><p>function get_img($_str=null){  </p></li><li><p>preg_match_all("/<strong><img</strong>\s+[^<strong>></strong>]*\s*src\s*=<br/>\s*([\'\"]?)([^\'\"<strong>></strong>\s]*)\\1\s*[^<strong>></strong>]*<strong>></strong>/i", <br/>$_str, $arr);  </p></li><li><p>print_r($arr[2]);  </p></li><li><p>}  </p></li><li><p>function get_link($_str=null){   </p></li><li><p>preg_match_all("/<strong><a.</strong>*href=[\'|\"](.+)?<br/>[\'|\"].*<strong>></strong>.+<strong><</strong>\/a<strong>></strong>/Uis", $_str, $arr);   </p></li><li><p>//print_r($arr);  </p></li><li><p>return $arr[1];  </p></li><li><p>}//end.get_link;  </p></li><li><p>function get_link_name($_str=null){   </p></li><li><p>preg_match_all("/<strong><a.</strong>*href=[\'|\"](.+)?<br/>[\'|\"].*<strong>></strong>(.+)<strong><</strong>\/a<strong>></strong>/Uis", $_str, $arr);  </p></li><li><p>return $arr[2];  </p></li><li><p>}//end.get_link_name;  </p></li><li><p>function link_list($_url=null, $_c=0){  </p></li><li><p>eregi('(^http://.*)/.*' , $_url , $array);  </p></li><li><p>$_url_0 = $array[1];  </p></li><li><p>$_html = $this-<strong>></strong>get_html($_url);  </p></li><li><p>$_link = $this-<strong>></strong>get_link($_html);  </p></li><li><p>$_list = $this-<strong>></strong>get_link_name($_html);  </p></li><li><p>$s = "";  </p></li><li><p>for($i=0;$i<strong><count</strong>($_link);$i++){  </p></li><li><p>$s .= "<br/>" . "<strong><INPUT</strong> TYPE='checkbox' <br/>NAME='link_name[]' value='" .$_link[$i]. "' <br/><strong>/></strong>" . $_list[$i] . "  ";  </p></li><li><p>echo "<strong><br/></strong>" . "<strong><INPUT</strong> TYPE='checkbox' <br/>NAME='link_name[]' value='" .$_link[$i]. "' <br/><strong>/></strong>" . $_list[$i] . "  ";  </p></li><li><p>echo "<strong><a</strong> href='" . $_url_0 . "/" . $_link[$i]<br/> . "' target='_blank'<strong>></strong>" . $_url_0 . "/" . <br/>$_link[$i] . "<strong></a></strong>";   </p></li><li><p>if($_c <strong><</strong> <strong>3</strong>){  </p></li><li><p>if(eregi('^[$_url_0|mailto:].*' ,$_link[$i])){   </p></li><li><p>echo "<strong><a</strong> href='" . $_link[$i] . "' <br/>target='_blank'<strong>></strong>" . $_link[$i] . "<strong></a></strong>";   </p></li><li><p>$s .= $this-<strong>></strong>link_list( $_link[$i] , $_c+1);  </p></li><li><p>}  </p></li><li><p>elseif(!eregi('^[http://|ftp://|file:///].<br/>*' ,$_link[$i])){  </p></li><li><p>$s .= $this-<strong>></strong>link_list( $_url_0 . "/" . $_link[$i] , $_c+1);  </p></li><li><p>}  </p></li><li><p>}  </p></li><li><p>}  </p></li><li><p>return $s;  </p></li><li><p>}//end.link_list;  </p></li><li><p>}//end.grabble. </p></li></ol><p><strong>PHP搜索引擎类2.调用实例:</strong></p><pre><ol><li><p>< ?php  </p></li><li><p>require_once("grabble.<br/>class.php");  </p></li><li><p>$gf = new grabble();  </p></li><li><p>echo $gf->link_list(<br/>'http://10.22.65.101/');  </p></li><li><p>?> </p></li></ol><br/></pre><p>以上是“PHP怎么实现搜索引擎类”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!</p> <br> 本文题目:PHP怎么实现搜索引擎类 <br> 网站网址:<a href="http://www.wjwzjz.com/article/ijieco.html">http://www.wjwzjz.com/article/ijieco.html</a> </div> </div> <div class="othernews"> <h3>其他资讯</h3> <div class="othernews_list"> <ul> <li> <a href="/article/hihjdp.html">linux终端命令变大 linux调整终端字体大小</a> </li><li> <a href="/article/hihjsh.html">php数据显示在表格里 php表格显示数据库信息</a> </li><li> <a href="/article/hihjoi.html">经典go语言 Go语言实战</a> </li><li> <a href="/article/hihghj.html">vb.net数组深拷贝 C#数组拷贝</a> </li><li> <a href="/article/hihjgp.html">JAVA功能代码写在哪里 java代码放在哪里</a> </li> </ul> </div> </div> </div> </div> <div class="footer"> <div class="footer_content"> <div class="footer_content_top clear"> <div class="content_top_share fl"> <div><img src="/Public/Home/img/logo.png"></div> <div class="top_share_content"> <dd>分享至:</dd> <dt class="bdsharebuttonbox clear" id="share"> <a href="#" class="bds_tsina iconfont fl" data-cmd="tsina" title="分享到新浪微博"></a> <a href="#" class="bds_sqq iconfont fl" data-cmd="sqq" title="分享到QQ好友"></a> <a href="#" class="bds_weixin iconfont fl" data-cmd="weixin" title="分享到微信"></a> <a href="#" class="bds_weixin iconfont fl" data-cmd="tieba" title="分享到贴吧"></a> </dt> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> </div> </div> <div class="content_top_left fl clear"> <div class="top_left_list fl"> <dd><a href="/about/">关于我们</a></dd> <dt> <a href="/about/#gsjj">公司简介</a> <a href="/about/#fzlc">发展历程</a> </dt> </div> <div class="top_left_list fl"> <dd><a href="/service/">服务项目</a></dd> <dt> <a href="/service/">高端网站建设</a> <a href="/miniprogram/">小程序开发</a> <a href="/service/app.html">APP开发</a> <a href="/service/yingxiao.html">网络营销</a> </dt> </div> <div class="top_left_list fl"> <dd><a href="/jianzhan/">建站知识</a></dd> <dt> <a href="/jianzhan/">行业新闻</a> <a href="/jianzhan/">建站学堂</a> <a href="/jianzhan/">常见问题</a> </dt> </div> <div class="top_left_list fl"> <dd><a href="/contact/">联系我们</a></dd> <dt> <a href="/contact/#lxwm">公司地址</a> <a href="/contact/#rczp">人才招聘</a> </dt> </div> </div> <div class="content_top_right addressR fr"> <div class="top_right_title addressf_title"> <a href="javascript:;" class="on">成都</a> </div> <div class="top_right_content addressf"> <div class="right_content_li on"> <div class="right_content_list clear"> <dd class="fl iconfont"></dd> <dt class="fl">电话:028-86922220</dt> </div> <div class="right_content_list clear"> <dd class="fl iconfont"></dd> <dt class="fl">地址:成都市太升南路288号锦天国际A幢1002号</dt> </div> </div> </div> </div> </div> </div> <div class="footer_content_copyright clear">版权所有:成都新网创想广告设计中心(普通合伙) <a href="http://beian.miit.gov.cn/" rel="nofollow" target="_blank">蜀ICP备11025516号-13</a> </div> </div> <!--浮窗--> <div class="FloatingWindow clear"> <a href="tencent://message/?uin=1683211881&Site=&Menu=yes" class="FloatingWindow_list fr"> <div class="FloatingWindow_list_title"> <dd class="iconfont"></dd> <dt><span>在线</span>咨询</dt> </div> </a> <a href="javascript:;" class="FloatingWindow_list fr"> <div class="FloatingWindow_list_title"> <dd class="iconfont"></dd> <dt>服务热线</dt> </div> <div class="FloatingWindow_list_down fadeInRight animated">服务热线:028-86922220</div> </a> <a href="javascript:;" class="FloatingWindow_list fr STop"> <div class="FloatingWindow_list_title"> <dd class="iconfont"></dd> <dt>TOP</dt> </div> </a> </div> <script src="/Public/Home/js/jquery-1.8.3.min.js"></script> <script src="/Public/Home/js/comm.js"></script> <script src="/Public/Home/js/wow.js"></script> <script src="/Public/Home/js/common.js"></script> </body> </html> <script> $(".cont img").each(function(){ var src = $(this).attr("src"); //获取图片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //绝对路径 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>