资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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://cdkjz.cn/article/ijieco.html">http://cdkjz.cn/article/ijieco.html</a> </div> <div class="g-return-wrapper clearfix"> <a href="http://www.cdkjz.cn/" class="home">返回首页</a> <a href="http://www.cdkjz.cn/news/" class="column">了解更多建站资讯</a> </div> </div> </div> <div class="full-related-news"> <h3 class="related-title">相关资讯</h3> <div class="related-news weblg"> <ul class="clearfix"> <li> <a href="/article/siodpc.html"> <h2 class="title">汕头短视频运营教学班招生</h2> </a> </li><li> <a href="/article/siocoo.html"> <h2 class="title">泰顺抖音代运营公司排名</h2> </a> </li><li> <a href="/article/siodji.html"> <h2 class="title">河北抖音推广代运营哪里有</h2> </a> </li><li> <a href="/article/siodcp.html"> <h2 class="title">抖音短视频运营营销策略</h2> </a> </li><li> <a href="/article/siodjh.html"> <h2 class="title">短视频运营要学会什么知识</h2> </a> </li><li> <a href="/article/siodpe.html"> <h2 class="title">讷河短视频运营</h2> </a> </li><li> <a href="/article/siodso.html"> <h2 class="title">平湖抖音企业号代运营外包</h2> </a> </li><li> <a href="/article/siodid.html"> <h2 class="title">穿搭视频号运营策略,穿搭账号运营策略</h2> </a> </li> </ul> </div> </div> <div class="full-icontact-cover m-ft-contact"> <div class="weblg"> <div class="clearfix content"> <div class="motto"> 多年建站经验 </div> <div class="info"> <h3>多一份参考,总有益处</h3> <h2> 联系快上网,免费获得专属《策划方案》及报价</h2> <div class="msg"> <p>咨询相关问题或预约面谈,可以通过以下方式与我们联系</p> <h4>业务热线:<a href="tel:400-028-6601" rel="nofollow">400-028-6601</a> / 大客户专线   成都:<a href="tel:+13518219792" rel="nofollow">13518219792</a>   座机:<a href="tel:02886922220" rel="nofollow">028-86922220</a> </h4> </div> </div> </div> <div class="btns clearfix"> <a href="https://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes" target="_blank" rel="nofollow" class="oline">在线咨询</a> <a href="javascript:;" class="edit" rel="nofollow">提交需求</a> </div> </div> </div> <div class="footer-content"> <div class="weblg clearfix"> <div class="friend-links"> <h6 class="clearfix"> <span class="tilte">友情链接</span> <a class="exchagne" href="http://wpa.qq.com/msgrd?v=3&uin=631063699&site=qq&menu=yes">交换友情链接</a> </h6> <div class="link-list clearfix"> <div class="link-slider"> <a href="https://www.xwcx.net/zuyong.html" title="成都主机租用" target="_blank">成都主机租用</a><a href="http://www.cdxwcx.cn/tuoguan/cdbgp.html" title="成都多线服务器托管" target="_blank">成都多线服务器托管</a><a href="https://www.cdxwcx.com/wangzhan/gaiban.html" title="网页改版" target="_blank">网页改版</a><a href="http://chengdu.cdcxhl.cn/" title="成都网站建设" target="_blank">成都网站建设</a><a href="https://www.cdcxhl.com/zhizuo/chengdu.html" title="四川成都网站制作" target="_blank">四川成都网站制作</a><a href="https://www.cdcxhl.com/idc/yldx.html" title="贵州义龙电信机房" target="_blank">贵州义龙电信机房</a><a href="https://www.cdcxhl.com/tuoguan/yaan/" title="雅安服务器托管" target="_blank">雅安服务器托管</a><a href="http://www.dearsh.com/" title="3D立体画" target="_blank">3D立体画</a><a href="https://www.cdcxhl.cn/" title="腾讯香港免备案空间" target="_blank">腾讯香港免备案空间</a><a href="http://seo.cdkjz.cn/wangzhan/" title="网站制作公司" target="_blank">网站制作公司</a> </div> </div> </div> </div> <div class="full-foot-bottom"> <div class="weblg clearfix"> <p>成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询<a href="tel:400-028-6601">400-028-6601</a></p> <p> 成都快上网科技有限公司-四川网站建设设计公司 | <a href="http://www.miitbeian.gov.cn/" target="_blank" rel="nofollow">蜀ICP备19037934号</a> Copyright 2020,ALL Rights Reserved cdkjz.cn | <a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a> | © Copyright 2020版权所有.</p> <p>专家团队为您提供<a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a>,<a href="http://www.cdkjz.cn/" target="_blank">成都网站设计</a>,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | <a href="###">网站建设地图</a></p> </div> </div> </div> <script type="text/javascript" src="../js/idangerous.swiper.min.js"></script> <script type="text/javascript" src="../js/wow.min.js"></script> <script type="text/javascript" src="../js/jquery.mousewheel.min.js"></script> <script type="text/javascript" src="../js/jquery.placeholder.min.js"></script> <script type="text/javascript" src="../js/layout.js"></script> </body> </html> <script> $(".singlepage 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>