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 Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142827 Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 thanks Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142843 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? Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142849 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] Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142867 Share on other sites More sharing options...
ted_chou12 Posted December 17, 2006 Author Share Posted December 17, 2006 okay, thankyou so much :D Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142869 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? Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142874 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. Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142875 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 Link to comment https://forums.phpfreaks.com/topic/30950-solved-about-the-glob-just-server-problem/#findComment-142877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.