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?