wordpress - PHP Unable To List Files From URL Directory -
I'm trying to get a listing in a WordPress template from a list of CSS files. I am trying to work with some luck to work down what am I doing?
$ path = parse_url (TC_BASE_URL. 'Custom / CSS /', PHP_URL_PATH); $ Dir = $ _SERVER ['DOCUMENT_ROOT'] $ path; $ Dir = str_replace ("/", "\\", $ dir); $ Dir = str_replace ("\\\\", "\\", $ dir); If (is_dir ($ dir)) {if ($ dh == opendir ($ dir)) {while (($ file = readdir ($ dh))! == false) {echo "filename: $ file: filetype:" . File type ($ dir $ .file) "\ N"; } Monkey ($ dh); } Else {echo $ dir is not 'Open'; }} And {echo $ dir is not a directory '; }
I have the following tests:
& Lt ;? Php $ ruta = "c: \\ www \\ wp-content \\ theme \\ custom \\ custom \\ css \\"; If (is_dir ($ ruta)) {if ($ dh = opendir ($ ruta)) {while (($ file = readdir ($ dh))! == false) {echo "file name: $ file: file type: "File type ($ Roota $.)" & Lt; / br & gt; "; } Monkey ($ dh); }}? & Gt;
Output:
file name :. File Type: DIR File name: ..: File type: DIR File name: Microsoft Word. Docx: File Type: File Name: Nuevo KuaiZip ZIP archive file.zip: File Type: File
< / Pre>
Comments
Post a Comment