Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [PHP] Altro problema con funzione - io non lo trovo...

    questa è la funzione:

    Codice PHP:
    function directory_list_2($path$types="directories"$recursive=0) {
     
    __ 
     __ 
    // get a list of just the dirs and turn the list into an array 
     
    __ // @path_ _ _ _ starting path from which to search
     
    __ // @types_ _ _ _ can be "directories", "files", or "all"
     
    __ // @recursive_ _ determines whether subdirectories are searched
     
    __ 
     __ 
    if ($dir opendir($path)) {
     
    __ _ _ $file_list = array();
     
    __ _ _ while (false !== ($file readdir($dir))){
     
    __ _ _ _ _ // ignore the . and .. file references
     
    __ _ _ _ _ if ($file != '.' && $file != '..') {
     
    __ _ _ _ _ _ _ // check whether this is a file or directory and whether we're interested in that type
     
    __ _ _ _ _ _ _ if ((is_dir($path."/".$file)) && (($types=="directories") || ($types=="all"))) {
     
    __ _ _ _ _ _ _ _ _ _ _ $file_list[] = $file;
     
    __ _ _ _ _ _ _ _ _ _ _ // if we're in a directory and we want recursive behavior, call this function again
     
    __ _ _ _ _ _ _ _ _ _ _ if ($recursive) {
     
    __ _ _ _ _ _ _ _ _ _ _ _ _ $file_list array_merge($file_listdirectory_list($path."/".$file."/"$types$recursive));
     
    __ _ _ _ _ _ _ _ _ _ _ }
     
    __ _ _ _ _ _ _ } else if (($types == "files") || ($types == "all")) {
     
    __ _ _ _ _ _ _ _ _ $file_list[] = $file;
     
    __ _ _ _ _ _ _ }
     
    __ _ _ _ _ }
     
    __ _ _ }
     
    __ _ _ closedir($dir);
     
    __ _ _ return $file_list;
     
    __ } else {
     
    __ _ _ return false;
     
    __ }
     
    __ 
     


    direi abb elementare... ma se chiamo la pagina che lo contiene mi da un "parse error", ed è abb strano (almeno a me non è mai capitato!!) xkè l'errore me lo dà anke se non invoco la funzione....mi dice sempre che alla linea 5 c'è 'sto benedetto errore di parsing.......boh

    Suggerimenti???
    Studente - Smanettone - WebDesigner
    www.vigomeano.it | e altri ancora...

  2. #2
    nessuno sa dirmi un possibile errore che causa un parse error?!?
    Studente - Smanettone - WebDesigner
    www.vigomeano.it | e altri ancora...

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2001
    Messaggi
    3,259
    prova a cambiare questo

    if ($dir = opendir($path)) {


    con questo

    if (false !==($dir = opendir($path))) {

  4. #4
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    posta l'errore completo!

  5. #5
    ho risolto grazie a tutti. cmq è strano xkè lo riscritto di nuovo e adesso va, o c'era qc carattere strano che inchiodava tutto o non so che altro pensare!!
    Studente - Smanettone - WebDesigner
    www.vigomeano.it | e altri ancora...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.