[php] is_dir() in WinXP

Pagina: 1
Acties:

  • Vulpes_Vulpes
  • Registratie: Februari 2001
  • Laatst online: 01-02-2022

Vulpes_Vulpes

SELECT * FROM internet

Topicstarter
Ik heb een scriptje die een dir uitleest. Nu wil ik dat alle DIRs vet worden weergegeven. Om te kijken of het een DIR is gebruik ik de functie: is_dir()

Het probleem is dat nu alleen de "." en de ".." als DIR worden gezien maar de rest niet... :/
edit:

Ik zie wel alle bestanden en dirs in de map. Het probleem is dat ie alleen de "." en ".." vet laat zien...


Met de uitleg op php.net kom ik niet veel verder en ook op phpbuilder.com heb ik niets bruikbaars kunnen vinden. :(

Ik gebruik:
Windows NT 5.1 build 2600
Apache 1.3.23 (Win32)
PHP Version 4.2.3

[ Voor 0% gewijzigd door Vulpes_Vulpes op 16-09-2002 16:26 . Reden: reply van Altaphista ]

Love begins with a metaphor. Which is to say, love begins at the point when a woman enters her first word into our poetic memory. - Milan Kundera


  • Altaphista
  • Registratie: Juli 2001
  • Laatst online: 01-09 09:22

Altaphista

1. check manual, 2. ask

print de dir eens, ik heb het ook es gehad, en toen bleek dat ik de verkeerde dir uitlas :)

Je gaat het pas zien als je het doorhebt.


  • riotrick
  • Registratie: Mei 2002
  • Laatst online: 17-08 00:22
is_dir() does not work correctly (i.e. returns false on some folders) unless you chdir() to folder that contains the file/folder you are checking.

wellicht dat jij daar ook last van hebt?

  • riotrick
  • Registratie: Mei 2002
  • Laatst online: 17-08 00:22
is_dir() does not work correctly (i.e. returns false on some folders) unless you chdir() to folder that contains the file/folder you are checking.

wellicht dat jij daar ook last van hebt?

  • Altaphista
  • Registratie: Juli 2001
  • Laatst online: 01-09 09:22

Altaphista

1. check manual, 2. ask

als je een dir wilt uitlezen moet je eerst chdir naar desbetreffende dir doen. :)

Je gaat het pas zien als je het doorhebt.


  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

PHP Manual / is_dir
Returns TRUE if the filename exists and is a directory. If filename is a relative filename, it will be checked relative to the current working directory.
Dus waar dat staat over die chdir is mij niet helemaal duidelijk.

print even de realpath van de dir waarop je checkt. kijk of die wel klopt. en dan, debug-ze ;)

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


  • Vulpes_Vulpes
  • Registratie: Februari 2001
  • Laatst online: 01-02-2022

Vulpes_Vulpes

SELECT * FROM internet

Topicstarter
Aan de reply's merk ik dat ik mijn probleem niet helemaal goed heb uitgelegd.
Ik weet zeker dat ik de goede dir te pakken heb, want hij laat alle content gewoon zien. Dir's en File's...
Het probleem is dat de is_dir() functie alleen de "." en de ".." als Dir aanziet en de rest als File's. :/ Ik wilde dus met is_dir() checken of het een Dir is en die dan vet laten printen. Hij print nu alleen "." en ".." vet.

Misschien gebruik ik de functie niet goed???

PHP:
1
2
3
4
5
if(is_dir($dContent) == 1){
         print "<b>$dContent</b><br>";
} else{
         print "$dContent<br>";
}

[ Voor 0% gewijzigd door Vulpes_Vulpes op 17-09-2002 00:35 . Reden: Code tags aangepast ]

Love begins with a metaphor. Which is to say, love begins at the point when a woman enters her first word into our poetic memory. - Milan Kundera


  • thomaske
  • Registratie: Juni 2000
  • Laatst online: 14-07 14:28

thomaske

» » » » » »

Maakt het wat uit als je dit doet:

PHP:
1
2
3
4
5
6
7
if(is_dir($dContent) == 1){
         print "<b>$dContent</b><br>";
} elseif (is_file($dContent)) {
         print "$dContent<br>";
} else {
         print "<I>$dContent</I><br>";
}


:?

Brusselmans: "Continuïteit bestaat niet, tenzij in zinloze vorm. Iets wat continu is, is obsessief, dus ziekelijk, dus oninteressant, dus zinloos."


  • Vulpes_Vulpes
  • Registratie: Februari 2001
  • Laatst online: 01-02-2022

Vulpes_Vulpes

SELECT * FROM internet

Topicstarter
Ok, het is gelukt! riotrick is idd w00t. :) Na de chdir() werkt de is_dir() wel goed. * Vulpes_Vulpes gaat weer lekker verder manuals doorspitten B) 8)7

[ Voor 0% gewijzigd door Vulpes_Vulpes op 17-09-2002 12:22 . Reden: typo ]

Love begins with a metaphor. Which is to say, love begins at the point when a woman enters her first word into our poetic memory. - Milan Kundera

Pagina: 1