Obtain the file 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 can help you?
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 file in the right column. this is the HTML structure.

The file directory is as follows:

// The clicked HTML file is displayed here // echo openFile (not written here );

// 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. ""; // output the array content echo"
";}Return $ fileArray;} // open the file 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]


Reply to discussion (solution)

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

In php, how does one implement a tree structure similar to the left-side structure of the resource manager?

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.