|
Posted by walterbyrd on 12/17/78 11:54
Alvaro G. Vicario wrote:
> What error are you getting?
>
This is what I'm using. It is copied almost verbatim from the php.net
examples for using the file() function. One difference: I'm using a
variable ($userfile), instead of a literal. The variable does contain a
file name, I've checked. If I replace the variable, with a literal,
this will work.
// Get a file into an array. In this example we'll go through HTTP to
get
// the HTML source of a URL.
$lines = file($userfile);
// Loop through our array, show HTML source as HTML source; and line
numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br
/>\n";
};
Here is the error that I'm getting:
Warning: Invalid argument supplied for foreach() . . .
Navigation:
[Reply to this message]
|