ted_chou12 Posted December 17, 2006 Share Posted December 17, 2006 I cannot get the glob() function to work, i think that is because i dont understand it fully enough, can anyone tell me what does the star in the glob function means?below is the example:[code]<?phpforeach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n";}?>[/code]Thanks,Ted Quote Link to comment Share on other sites More sharing options...
artacus Posted December 17, 2006 Share Posted December 17, 2006 the star is pattern matching. This will look for all .txt files in the directory. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 thanks Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 but where do you put the path to your files? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 17, 2006 Share Posted December 17, 2006 [quote author=ted_chou12 link=topic=118948.msg486560#msg486560 date=1166347419]but where do you put the path to your files?[/quote][code]<?php$files = glob("path/to/your/files/*.*");?>[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 okay, thankyou so much :D Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 when i inserted the glob() function, it just doesn't appear any files at all, does that mean my host server dont support it? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 17, 2006 Share Posted December 17, 2006 If your servers version of PHP is below 4.3.0 then it doesn't support the glob() function. If your version of PHP does support it, you're not using the function correctly. [url=http://www.php.net/glob]Check the manual[/url] for more examples. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 i tried the exact script on two different servers, one appears file and my current one doesn't, i guess is my host's server problem.thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.