实例讲解PHP搜索引擎类-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

实例讲解PHP搜索引擎类

我们为大家详细介绍了有关PHP搜索引擎类的一些使用方法,希望对大家有些帮助。下面我们先以一个范例来讲解类文件的概念。#t#

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);  </li><li>return $matches[1][0];  </li><li>}//end.get_title;  </li><li>function get_img($_str=null){  </li><li>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);  </li><li>print_r($arr[2]);  </li><li>}  </li><li>function get_link($_str=null){   </li><li>preg_match_all("/<strong><a.</strong>*href=[\'|\"](.+)?<br /> [\'|\"].*<strong>></strong>.+<strong><</strong>\/a<strong>></strong>/Uis", $_str, $arr);   </li><li>//print_r($arr);  </li><li>return $arr[1];  </li><li>}//end.get_link;  </li><li>function get_link_name($_str=null){   </li><li>preg_match_all("/<strong><a.</strong>*href=[\'|\"](.+)?<br /> [\'|\"].*<strong>></strong>(.+)<strong><</strong>\/a<strong>></strong>/Uis", $_str, $arr);  </li><li>return $arr[2];  </li><li>}//end.get_link_name;  </li><li>function link_list($_url=null, $_c=0){  </li><li>eregi('(^http://.*)/.*' , $_url , $array);  </li><li>$_url_0 = $array[1];  </li><li>$_html = $this-<strong>></strong>get_html($_url);  </li><li>$_link = $this-<strong>></strong>get_link($_html);  </li><li>$_list = $this-<strong>></strong>get_link_name($_html);  </li><li>$s = "";  </li><li>for($i=0;$i<strong><count</strong>($_link);$i++){  </li><li>$s .= "<br/>" . "<strong><INPUT</strong> TYPE='checkbox' <br /> NAME='link_name[]' value='" .$_link[$i]. "' <br /> <strong>/></strong>" . $_list[$i] . "  ";  </li><li>echo "<strong><br/></strong>" . "<strong><INPUT</strong> TYPE='checkbox' <br /> NAME='link_name[]' value='" .$_link[$i]. "' <br /> <strong>/></strong>" . $_list[$i] . "  ";  </li><li>echo "<strong><a</strong> href='" . $_url_0 . "/" . $_link[$i]<br />  . "' target='_blank'<strong>></strong>" . $_url_0 . "/" . <br /> $_link[$i] . "<strong></a></strong>";   </li><li>if($_c <strong><</strong> <strong>3</strong>){  </li><li>if(eregi('^[$_url_0|mailto:].*' ,$_link[$i])){   </li><li>echo "<strong><a</strong> href='" . $_link[$i] . "' <br /> target='_blank'<strong>></strong>" . $_link[$i] . "<strong></a></strong>";   </li><li>$s .= $this-<strong>></strong>link_list( $_link[$i] , $_c+1);  </li><li>}  </li><li>elseif(!eregi('^[http://|ftp://|file:///].<br /> *' ,$_link[$i])){  </li><li>$s .= $this-<strong>></strong>link_list( $_url_0 . "/" . $_link[$i] , $_c+1);  </li><li>}  </li><li>}  </li><li>}  </li><li>return $s;  </li><li>}//end.link_list;  </li><li>}//end.grabble. </li></ol><p><strong>PHP搜索引擎类2.调用实例:</strong></p><pre> <ol> <li>< ?php  </li> <li>require_once("grabble.<br>class.php");  </li> <li>$gf = new grabble();  </li> <li>echo $gf->link_list(<br>'http://10.22.65.101/');  </li> <li>?> </li> </ol><br></pre><p> 以上就是PHP搜索引擎类的相关使用方法。</p> <br> 分享文章:实例讲解PHP搜索引擎类 <br> 本文地址:<a href="http://kswsj.cn/article/djospoe.html">http://kswsj.cn/article/djospoe.html</a> </div> </div> <div class="other"> <h3>其他资讯</h3> <ul> <li> <a href="/article/dpgjpho.html">Redis淘汰策略的不起作用(redis淘汰策略没生效)</a> </li><li> <a href="/article/dpgjpjj.html">IIS新手指南:将IIS与Azure服务集成</a> </li><li> <a href="/article/dpgjpgp.html">网站备案怎么取消?备案期间关闭网站服务</a> </li><li> <a href="/article/dpgjphe.html">传统岗位新挑战:信息安全之路</a> </li><li> <a href="/article/dpgjphc.html">高并发下如何生成唯一订单号?(redis怎么做用户唯一标识)</a> </li> </ul> </div> </div> <div class="line"></div> <!--底部--> <footer id="5"> <div class="foot1 container"> <div class="list"> <div class="item"> <a href="javascript:;"> <span class="ico1"><i class="iconfont"></i><img src="/Public/Home/img/ewm.png" alt=""></span> <strong>关注我们</strong> </a> </div> <div class="item"> <a href="" target="_blank"> <span><i class="iconfont"></i></span> <strong>索要报价</strong> </a> </div> <div class="item"> <a href="" target="_blank"> <span><i class="iconfont"></i></span> <strong>我要咨询</strong> </a> </div> <div class="item"> <a href="" target="_blank"> <span><i class="iconfont"></i></span> <strong>找到我们</strong> </a> </div> <div class="item"> <a href="" target="_blank"> <span><i class="iconfont"></i></span> <strong>投诉建议</strong> </a> </div> </div> <div class="tel"> <dl> <tel><a href="tel:400-028-6601" target="_blank">400-028-6601</a></tel><br> <span>也许您需要专业的服务,欢迎来电咨询</span> </dl> <dl> <tel><a href="tel:18980820575" target="_blank">18980820575</a></tel><br> <span>您的需求,是我们前进的动力</span> </dl> </div> </div> <div class="friend"> <div class="container"> <span class="tit">友情链接:</span> <div class="inner"> <a href="https://www.cdcxhl.com/yunying.html" target="_blank">网站托管运营</a><a href="https://www.cdcxhl.com/" target="_blank">成都做网站</a><a href="https://www.cdcxhl.com/tuoguan/" target="_blank">IDC机房托管</a><a href="https://www.cdcxhl.com/zuyong/" target="_blank">成都租用服务器</a><a href="https://www.cdcxhl.com/zuyong/" target="_blank">成都服务器租用</a><a href="https://www.cdcxhl.com/" target="_blank">成都网站建设公司</a><a href="https://www.cdcxhl.com/seo.html" target="_blank">成都网站推广</a><a href="https://www.cdcxhl.com/app.html" target="_blank">成都app软件开发</a><a href="https://www.cdcxhl.com/xiaochengx.html" target="_blank">小程序开发</a><a href="https://www.cdcxhl.com/jigui/" target="_blank">服务器机柜租赁</a><a href="https://www.cdcxhl.com/yunying.html" target="_blank">网站运营</a><a href="https://www.cdcxhl.com/" target="_blank">成都建站</a><a href="https://www.cdcxhl.com/zuyong/" target="_blank">成都物理服务器租用</a><a href="https://www.cdcxhl.com/xiaochengx.html" target="_blank">成都小程序开发公司</a><a href="https://www.cdcxhl.com/mobile.html" target="_blank">成都手机网站制作</a><a href="https://www.cdcxhl.com/ruanwen/" target="_blank">营销软文</a><a href="https://www.cdcxhl.com/" target="_blank">成都网站制作公司</a><a href="https://www.cdcxhl.com/jigui/" target="_blank">服务器托管机柜</a> </div> </div> </div> <div class="foot"> <div class="container"> <div class="footNav"> <h3>网站建设</h3> <a href="https://www.cdcxhl.com/qiye.html" target="_blank">企业网站建设</a><a href="https://www.cdxwcx.com/wangzhan/mobile.html" target="_blank">成都手机网站建设</a><a href="http://www.cdkjz.cn/fangan/" target="_blank">网站建设方案</a> </div> <div class="footNav"> <h3>服务器托管</h3> <a href="https://www.cdcxhl.com/jigui/" target="_blank">成都机柜租用</a><a href="http://www.cdxwcx.cn/tuoguan/mianyang.html" target="_blank">绵阳机房托管</a><a href="https://www.xwcx.net/" target="_blank">成都机柜租用</a> </div> <div class="footNav"> <h3>网站制作</h3> <a href="http://www.cxjianzhan.com/" target="_blank">网站制作</a><a href="http://www.36103.cn/" target="_blank">成都网站制作</a><a href="https://www.cdcxhl.com/" target="_blank">网站制作</a> </div> <div class="footNav"> <h3>企业服务</h3> <a href="https://www.cdcxhl.com/mianfei/jianzhan/" target="_blank">免费建站模板</a><a href="https://www.cdcxhl.com/service/ssl.html" target="_blank">ssl证书</a><a href="https://www.cdcxhl.com/ruanwen/yingxiao/" target="_blank">软文平台</a> </div> <div class="fr ecode"> <div class="fl"> <img src="/Public/Home/img/ewm.jpg"> <p>关注企业微信</p> </div> <div class="fr slogan"> <p class="icon"> <a class="ph" href=""><i class="iconfont"></i></a> <a class="qq" href="tencent://message/?uin=1683211881&Site=&Menu=yes"><i class="iconfont"></i></a> </p> <p> <i>想要找 </i> <a href="">小程序开发</a>、<a href="">APP开发</a>、 <a href="">营销型网站建设</a>、<a href="">网站建设</a>、 <i><a href="">网站定制开发</a></i> ,就选<a href="">创新互联</a> </p> </div> </div> </div> <div class="bottom container"> <p class="fl"> 版权所有:成都创新互联科技有限公司 备案号:<a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">蜀ICP备19037934号</a> 服务热线:028-86922220 </p> <p class="fr"> <a href="https://www.cdxwcx.com/" target="_blank">成都网站建设</a>: <a href="https://www.cdcxhl.com/" target="_blank">创新互联</a> </p> </div> </div> </footer> <!--在线咨询--> <div class="fot"> <ul> <li> <a href="https://p.qiao.baidu.com/cps/mobileChat?siteId=11284691&userId=6256368&type=1&reqParam=%20{%22from%22:0,%22sessionid%22:%22%22,%22siteId%22:%2211284691%22,%22tid%22:%22-1%22,%22userId%22:%226256368%22,%22ttype%22:1,%22siteConfig%22:%20{%22eid%22:%226256368%22,%22queuing%22:%22%22,%22siteToken%22:%226ce441ff9e2d6bedbdfc2a4138de449e%22,%22userId%22:%226256368%22,%22isGray%22:%22false%22,%22wsUrl%22:%22wss://p.qiao.baidu.com/cps3/websocket%22,%22likeVersion%22:%22generic%22,%22siteId%22:%2211284691%22,%22online%22:%22true%22,%22webRoot%22:%22//p.qiao.baidu.com/cps3/%22,%22bid%22:%22160142915792139572%22,%22isSmallFlow%22:0,%22isPreonline%22:0,%22invited%22:0%20},%22config%22:%20{%22themeColor%22:%224d74fa%22%20}%20}&appId=&referer=&iswechat=0&expectWaiter=-1&openid=null&otherParam=null&telephone=null&speedLogId=null&eid=null&siteToken=6ce441ff9e2d6bedbdfc2a4138de449e" target="_blank"> <img src="/Public/Home/img/fot1.png" alt=""> <p>在线咨询</p> </a> </li> <li> <a href="tel:18980820575" target="_blank"> <img src="/Public/Home/img/fot2.png" alt=""> <p>拨打电话</p> </a> </li> </ul> </div> </body> </html> <script> $(".con 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>