Re: Opening a file

From: Date: Wed, 05 Sep 2007 15:15:11 +0000
Subject: Re: Opening a file
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-261735@lists.php.net to get a copy of this message
Dan Shirah wrote:
I did a if ($lines === false) { echo "lines is false"; } like you suggested and it displays that text...but it still make no sense. mypage.php and fruits.txt are in the same folder, on the same server. There isn't any permissions issues. So, if mypage.php and fruits.txt are in the same folder, then $lines = file("fruits.txt") should be valid.
Is mypage.php the script you're calling or is it being included from a script in a different directory? The 'current directory' is the directory of the main script, not included scripts. Use dirname(__FILE__) to get the path to the current script. -Stut -- http://stut.net/

« previous php.general (#261735) next »