Home  >  Article  >  Backend Development  >  Very good directory navigation file code_PHP tutorial

Very good directory navigation file code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:03:14810browse

Although this code is short, it is very practical. It can easily create a hyperlink to the file with the specified suffix name in the directory you specify, and it can be set so that the homepage of the specified directory will not be navigated.

function navbar(){
$files = dir("."); //Specify directory
$pipe = " | "; //Pipe character
//Search all files in the directory through the following loop
while ($current = $files->read()) {
//ignor all files not of htm type.
if (strpos ($current, "php")!= FALSE) //Set files with the suffix PHP to be navigated
//Ignore itself (such as index.html)
{ if (strpos($current, "ndex ") == FALSE)
                                                                                                         > print "";
             print $pipe; >




http://www.bkjia.com/PHPjc/316316.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/316316.html

TechArticle

Although this code is short, it is very practical. It can easily create files with the specified suffix name in the directory you specify. Hyperlink, and can be set so that the specified directory homepage will not be navigated. ...
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