導航:首頁 > 編程語言 > php簡單的搜索引擎

php簡單的搜索引擎

發布時間:2022-04-27 06:13:58

A. 用php怎樣實現一個文本搜索引擎

什麼叫資料庫是用txt的??
搜索靜態網頁,可以直接用fopen,file之類函數打開文件,然後用字元串函數strstr等來查詢是否含有搜索關鍵字,最好是用字元串的一些函數,因為eregi等函數在這個問題上的效率要低的多

B. php搜索引擎蜘蛛程序

推薦一個國外知名度頗高的搜索引擎,含有網頁蜘蛛程序,以前好象有人想要這方面的資料,現在有了,大家可以研究下源碼

官方網站:
http://phpdig.toiletoine.net/

演示:
http://phpdig.toiletoine.net/sea ... te=100&option=start

中文版本和演示,我以前提供過(1.62版本的漢化),2003年11月換空間的時候沒備份,沒了。找下載了的人看看有沒有。

下載:
這是最近(2003年12月)更新的版本的下載(1.65 En):
http://www.phpdig.net/navigation.php?action=download

演示:
http://www.phpdig.net/navigation.php?action=demo

主要功能:
類似google、網路的搜索引擎,php+mysql。

PhpDig is a http spider/search engine written in Php with a MySql database in backend.

HTTP Spidering : PhpDig follows links as it was any web browser within a web server, to build the pages list to index. Links can be in AreaMap, or frames. PhpDig supports relocations. Any syntax of HREF attribute is followed by Phpdig.
PhpDig don't go out the root site you define for the indexing. Spidering depth is choosen by user.
All html content is listed, both static and dynamic pages. PhpDig searches the Mime-Type of the document, or tests existence of an tag at the beginning of it.

支持全文搜索
Full Text indexing : PhpDig indexes all words of a document, excepting small words (less than 3 letters) an common words, those are definded in a text file.
Lone numbers are not inded, but those included in words. Underscores make part of a word.
Occurences of a word in a document is saved. Words in the title can have a more important weight in ranking results.

支持多種格式文件的索引,如pdf
File types wich can be indexed : PhpDig indexes HTML and text files by itself.
PhpDig could index PDF, MS-Word and MS-Excel files if you install external binaries on the spidering machines to this purpose.
To demonstrate the feature, you can search into Hamlet (tragedy, William Shakespeare) in MS-Word format, and L'Avare (comedy, Molière) in Pdf format.

支持robots
Other features : PhpDig Tries to read a robots.txt file at the server root. It searches meta robots tags too.
The Last-Modified header value is stored in the database to avoid rendant indexing. Also the meta revisit-after tag.

可針對特定網站進行全文索引,蜘蛛可1-9個層自動獲取全部url

其中的蜘蛛程序寫得十分好,有興趣的朋友推薦研究下。

希望對你有用!

C. 求問大神php怎麼簡單實現搜索引擎 就是文本框輸入值然後點擊按鈕下面出現輸入的值並且變紅

將搜索結果內容中的關鍵字替換成<span style="color:#f00;"> 關鍵字</span>

D. php 分詞,搜索引擎,技術

你好,很高興為你解答:

如果你僅僅是要把長句中的單詞分出來,那是很簡單的:

<?php
$str="GoogleTranslateforBusiness!";
$str=preg_replace("{.|,|;|:|'|"|?|!|<|>|(|)}","",$str);//移除所有標點符號
$arr=array_unique(explode("",$str));//以空格分割,並去重
var_mp($arr);
?>

以下是一段測試文本:

(asseeninCorPerl),"something"(inthiscase,output"Hi,I'maPHPscript!").<?phpand?>"PHPmode."
-,.,.,andthenthere'.
,.Don''sfeatures.Youcanjumpin,inashorttime,.
AlthoughPHP'sdevelopmentisfocusedonserver-sidescripting,youcandomuchmorewithit.Readon,andseemoreintheWhatcanPHPdo?section,.

輸出結果:

Instead,of,lots,commands,to,output,HTML,as,seen,in,C,or,Perl,PHP,pages,contain,with,embedded,code,that,does,something,this,case,Hi,Im,a,script,The,is,enclosed,special,start,and,end,processing,instructions,php,,allow,you,jump,into,out,modeWhat,distinguishes,from,like,client-side,javaScript,the,executed,on,server,generating,which,then,sent,client,would,receive,results,running,but,not,know,what,underlying,was,You,can,even,configure,your,web,process,all,files,theres,really,no,way,users,tell,have,up,sleeveThe,best,things,using,are,it,extremely,simple,for,newcomer,offers,many,advanced,features,professional,programmer,Dont,be,afraid,reading,long,list,PHPs,short,time,writing,scripts,few,hoursAlthough,development,focused,server-side,scripting,do,much,more,Read,see,What,section,go,right,introctory,tutorial,if,only,interested,programming

使用sort()對其進行排序:

C,Dont,HTML,Hi,Im,Instead,JavaScript,PHP,PHPs,Perl,Read,The,What,You,a,advanced,afraid,all,allow,and,are,as,be,best,but,can,case,client,client-side,code,commands,configure,contain,development,distinguishes,do,does,embedded,enclosed,end,even,executed,extremely,features,few,files,focused,for,from,generating,go,have,hoursAlthough,if,in,instructions,interested,into,introctory,is,it,jump,know,like,list,long,lots,many,modeWhat,more,much,newcomer,no,not,of,offers,on,only,or,out,output,pages,php,process,processing,professional,programmer,programming,reading,really,receive,results,right,running,script,scripting,scripts,section,see,seen,sent,server,server-side,short,simple,sleeveThe,something,special,start,tell,that,the,then,theres,things,this,time,to,tutorial,underlying,up,users,using,was,way,web,what,which,with,would,writing,you,your

-----------------------------------
如有疑問歡迎追問!
滿意請點擊右上方【選為滿意回答】按鈕么么噠 o(∩_∩)o

E. php中如何使用sphinx搜索引擎

一. 安裝、配置

1.ubuntu安裝sphinx

如果沒有安裝aptitude ,需要先安裝 aptitude

2.配置

3.執行命令分詞,會在/var/lib/sphinxsearch/data/test1 目錄下生成一堆索引文件

sudo indexer -c /etc/sphinxsearch/sphinx.conf test1

test1為上述配置文件的index名字

4.命令行測試搜索

sudo search -c /etc/sphinxsearch/sphinx.conf google

二.在php中使用,安裝php、sphinx的依賴庫

  1. 安裝 aptitudeapt-get install aptitude

sudo aptitude install libsphinxclient-dev libsphinxclient-0.0.1 -y

2.安裝php sphinx的擴展

安裝 pecl
sudo apt-get install php-pear php5-dev
在安裝sphinx
sudo pecl install sphinx

3.在配置文件php.ini中添加sphinx的擴展,

我的php.ini文件為
sudo vim /etc/php5/fpm/php.ini
獲取自己的php.ini文件位置使用
php5-fpm -i|grep ini

添加:
extension=sphinx.so


4.重啟php5-fpm,查看php是否載入sphinx模塊
sudo /etc/init.d/php5-fpm restart


5.將search程序運行在後台
sudo searchd -c /etc/sphinxsearch/sphinx.conf
默認監聽配置文件中的埠:9312

6.在thinkphp中調用搜索

搜索完畢,返回結果(默認返回20條,修改返回條數用添加$s->SetLimits(0, 1000, 1000);),搜索速度相當快,索引80w條數據的title和description兩個欄位耗時不到10s,該搜索引擎支持增量索引,多種模式的搜索,網上的資料也非常多

F. PHP全文索引、搜索引擎

http://wenku..com/view/40b10e63ddccda38376baf90.html這是一個網路文庫的資料,如果你又賬號,最好下載下來看,應該不錯

G. 開源 中文php搜索引擎有哪些

某目前接觸到的只有lucene和coreseek了
lucene更多是用在java方面的,但是也可以和php結合起來用
coreseek和php結合使用比較好,官方文檔說的很詳細
君且自學自勉哇。

H. php可以做搜索引擎嗎

大部分知名網站後台都是使用PHP處理的,那是因為PHP的LAMP深得人心.
就像PHPCHINA的FANS們年度采訪各大網站技術總監說的那樣,使用LAMP是因為不用花錢,速度還可以,但是對於重要的數據使用ORACLE,那是因為,ORACLE花了大價錢,就會有大的服務,LAMP都是免費的!

I. 如何用PHP製作搜索引擎

這樣看你做什麼樣的搜索,如果要做全站搜索的話,只用資料庫搜索做起來會比較困難,會遇到要檢索的數據存在不同的表中,甚至不同的庫中,如果是全站搜索的話,建議用sphinx或者lucener,如果只是某個表內容搜索的話,sql:select * from 表名 where 列名 like '%值%' ;然後循環 mysql_fetch_array() 或 mysql_fetch_assoc() 或 mysql_fetch_object() 或 mysql_fetch_row()都取一行記錄,把記錄循環出來就可以了。

J. php做搜索引擎,實現隨機輸入字元串,能找出包含該字元串的所有文件,並列出文件的路徑

能實現,你要熟悉PHP的目錄函數

chdir -- 改變目錄
chroot -- 改變根目錄
dir -- directory 類
closedir -- 關閉目錄句柄
getcwd -- 取得當前工作目錄
opendir -- 打開目錄句柄
readdir -- 從目錄句柄中讀取條目
rewinddir -- 倒回目錄句柄
scandir -- 列出指定路徑中的文件和目錄

還有就是讀文件的函數。

你可以遍歷目錄,並讀取目錄下的每個文件,並用 strpos函數匹配輸入的字元串是否存在,最終得到結果

閱讀全文

與php簡單的搜索引擎相關的資料

熱點內容
壓縮機異音影響製冷嗎 瀏覽:711
德斯蘭壓縮機 瀏覽:490
程序員太極拳視頻 瀏覽:531
網上購買加密鎖 瀏覽:825
安卓為什麼軟體要隱私 瀏覽:83
虛擬主機管理源碼 瀏覽:811
java圖形圖像 瀏覽:230
單片機輸出口電平 瀏覽:486
java配置資料庫連接 瀏覽:479
java多態的體現 瀏覽:554
java的split分隔符 瀏覽:128
跪著敲代碼的程序員 瀏覽:238
web和php有什麼區別 瀏覽:120
加密的電梯卡怎麼復制蘋果手機 瀏覽:218
warez壓縮 瀏覽:137
黑馬程序員培訓機構官網天津 瀏覽:904
mainjavasrc 瀏覽:58
如何買伺服器挖礦 瀏覽:292
php批量上傳文件夾 瀏覽:560
安卓固件怎麼更新 瀏覽:169