Home  >  Article  >  Backend Development  >  Search method of PHP text database_PHP tutorial

Search method of PHP text database_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:10:13818browse

PHP text database search method searchstr=("/".preg_quote($searchstr)."/"); //$searchstr is the search keyword $records=file($file);//Get the number of all records/ /$file is the searched data file $search_reocrds=preg_grep ($searchstr, $records); //Start to search for records //$search_reocrds is the number of records found unset($records); if($search_records){ //Start To display records, write your own handler************************ while (list ($key, $val) = each ( $search_records)) { echo " $val
"; } //****************************************** ************ }

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314287.htmlTechArticleSearch method for PHP text database searchstr=("/".preg_quote($searchstr)."/"); //$searchstr is the search keyword $records=file($file);//Get the number of all records //$file is the search data...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn