Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement search engine Class with PHP

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to achieve PHP search engine class, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

PHP search engine class 1. Class file:

Class grabble {

Var $filename

Var $html

Var $urls = array (); / / url history

Var $url

Var $url_1

Function grabble () {

Set_time_limit (3600)

}

Function set ($_ filename) {

$this- > filename = $_ filename

Array_push ($this- > url, $_ filename)

} / / end.set

Function set_url ($_ url) {

Eregi ('(^ http://.*[^/]).*', $_ url, $array)

This- > url = $array [1]. "/"

Eregi ('(^ http://.*[^/]).*', $_ url, $array)

/ / print_r ($array)

$this- > url_1 = $array [1]

}

Function get () {

} / / end.get

Function get_html ($_ filename=null) {

$this- > filename = $_ filename

$this- > html = @ implode ('', file ($_ filename))

Return $this- > html

} / / end.get_html

Function get_title ($_ str=null) {

Preg_match_all ("/ (. *)

/ Uis ", $_ str, $matches)

Return $matches [1] [0]

} / / end.get_title

Function get_img ($_ str=null) {

Preg_match_all ("/] *\ s*src\ sgiving =

\ s* ([\ "]?) ([^\" >\ s] *)\ 1\ s* [^ >] * > / I "

$_ str, $arr)

Print_r ($arr [2])

}

Function get_link ($_ str=null) {

Preg_match_all ("/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report