RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
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://scyingshan.cn/article/ijieco.html">http://scyingshan.cn/article/ijieco.html</a> </div> <div class="hot_new"> <div class="page_title clearfix"> <h3>其他资讯</h3> </div> <div class="news_list clearfix"> <ul> <li> <a href="/article/dciogee.html">sappo系统英文的简单介绍</a> </li><li> <a href="/article/dcioipc.html">go语言函数变量 go函数调用</a> </li><li> <a href="/article/dciogce.html">腾讯云服务器木马拦截 腾讯云服务器ddos防御</a> </li><li> <a href="/article/dciogcc.html">阿里云怎么储存服务器内容 阿里云怎么储存服务器内容的</a> </li><li> <a href="/article/dciogsd.html">头条号服务器安全吗 头条号服务器安全吗可信吗</a> </li> </ul> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- 底部信息 --> <div class="footer wow fadeInUp"> <div class="rowFluid"> <div class="span12"> <div class="container"> <div class="footer_content"> <div class="span4 col-xm-12"> <div class="footer_list"> <div class="span6"> <div class="bottom_logo"><img src="/Public/Home/images/ewm.jpg" alt="微信服务号二维码" /></div> </div> <div class="span6 col-xm-12"> <div class="quick_navigation"> <div class="quick_navigation_title">快速导航</div> <ul> <li><a href="http://www.scghjhjc.cn/" title="四川锦华橡塑" target="_blank">四川锦华橡塑</a></li><li><a href="http://www.bjjxxy.cn/" title="圣月阀门" target="_blank">圣月阀门</a></li><li><a href="https://www.cdcxhl.cn/ " title="香港空间腾讯云" target="_blank">香港空间腾讯云</a></li><li><a href="https://www.cdcxhl.com/weihu/" title="企业网站维护" target="_blank">企业网站维护</a></li><li><a href="https://www.cdxwcx.com/jifang/meishan.html" title="联通机柜租用" target="_blank">联通机柜租用</a></li><li><a href="https://www.cdxwcx.com/wangzhan/gaiban.html" title="成都网站改版" target="_blank">成都网站改版</a></li><li><a href="http://chengdu.cdcxhl.cn/dingzhi/ " title="高端定制网站设计" target="_blank">高端定制网站设计</a></li> </ul> </div> </div> </div> </div> <div class="span4 col-xm-6 col-xs-12"> <div class="footer_list"> <div class="footer_link"> <div class="footer_link_title">友情链接</div> <ul id="frientLinks"> <a href="https://www.cdcxhl.com/" title="网站制作" target="_blank">网站制作</a> <a href="https://www.cdcxhl.com/" title="网站建设" target="_blank">网站建设</a> <a href="https://www.cdxwcx.com/tuiguang/" title="成都网络推广" target="_blank">网络推广</a> <a href="http://seo.cdkjz.cn/" title="成都网站推广" target="_blank">网站推广</a> <a href="https://www.cdcxhl.com/xiaochengx.html" title="成都微信小程序开发" target="_blank">小程序开发</a> <a href="https://www.cdcxhl.com/menu.html" title="创新互联网站栏目导航" target="_blank">网站导航</a> </ul> <div class="footer_link_title">网站建设</div> <ul id="frientLinks"> <li><a href="/">营山大橙子建站</a></li> <li><a href="https://www.cdcxhl.com/menu.html" title="创新互联网站栏目导航" target="_blank">网站导航</a></li> </ul> </div> </div> </div> <div class="span4 col-xm-6 col-xs-12"> <div class="footer_list"> <div class="footer_cotact"> <div class="footer_cotact_title">联系方式</div> <ul> <li><span class="footer_cotact_type">企业:</span><span class="footer_cotact_content">青羊区大橙子信息咨询工作室</span></li> <li><span class="footer_cotact_type">地址:</span><span class="footer_cotact_content">成都市青羊区太升南路288号</span></li> <li><span class="footer_cotact_type">电话:</span><span class="footer_cotact_content"><a href="tel:18980820575" class="call">18980820575</a></span></li> <li><span class="footer_cotact_type">网址:</span><span class="footer_cotact_content"><a href="/" title="营山网站建设">www.scyingshan.cn</a></span></li> </ul> </div> </div> </div> </div> </div> <div class="copyright"> <p>公司名称:青羊区大橙子信息咨询工作室 联系电话:18980820575</p> <p><a href="http://beian.miit.gov.cn" target="_blank" rel="nofollow">网站备案号:蜀ICP备2022028542号-24</a></p> <p>营山大橙子建站 营山网站建设 营山网站设计 营山网站制作 <a href="http://www.cdxwcx.cn/" target="_blank">成都做网站</a></p> </div> </div> </div> </div> </body> </html> <script> $(".technical_support_box_z_info_box 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>