Obtain the information list and click the file name to open the file. Which of the following can help you?

Source: Internet
Author: User
Obtain the file list and click the file name to open the file. Which of the following has time to help? in the left column, extract all HTML files in a directory and click the file name, the HTML file you click on is displayed in the right column. this is the HTML structure & lt; div & nbsp; & gt; & lt; p & gt; the file directory is as follows: & lt; p & gt; & lt; div & nbsp; & gt; obtain the file list and click the file name to open the file. Which of the following time can you help me?
In the left and right columns, all HTML files in a directory are extracted from the left column. click the file name to display the clicked HTML files in the right column.
This is an HTML structure


The file directory is as follows:



GetFile ("directory path to be indexed ");
?>




// The clicked HTML file is displayed here.
// Echo openFile (won't be written here );



// Obtain the object list function
Function getFile ($ dir ){
$ FileArray [] = NULL;
If (false! = ($ Handle = opendir ($ dir ))){
$ I = 0;
While (false! ==( $ File = readdir ($ handle ))){
// Remove "". "," .. ", and files with the suffix". xxx"
If ($ file! = "." & $ File! = ".." & Strpos ($ file ,".")){
$ FileArray [$ I] = "". $ file;
If ($ I == 100 ){
Break;
}
$ I ++;
}
}
// Close the handle
Closedir ($ handle );
}
Foreach ($ fileArray as $ value)
{
Echo "". $ value. ""; // The array content is output here.
Echo"
";
}
Return $ fileArray;
}

// Open the file function
Function openFile ($ filename)
{
$ Return = '';
If ($ fp = fopen ($ filename, 'RB '))
{
While (! Feof ($ fp ))
{
$ Return. = fread ($ fp, 1024 );
}
Fclose ($ fp );
Return $ return;
}
Else
{
Return false;
}
}
[Code = php]
[/Code]

Share:

The file directory is as follows... 'data-pics = ''>


------ Solution --------------------
Use the frame for layout. specify the target attribute in TAG. Refer to the csdn Forum.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.