Answer the question
In order to leave comments, you need to log in
Why is the file (php) not being read?
<?php
class Myclass {
public $fullText='';
public function SayHello($text) {
echo 'i,'.__CLASS__.'.I say '.$text.'';
}
/////////////////////////////////
public function ReadFile() {
if (fopen("readit.txt", "r"))
{
while (!feof(fopen("readIt.txt", "r")))
{
$this->fullText .= fgets(fopen("readIt.txt", "r"), 999);
}
}
return $this->fullText;
}
/////////////////////////////////
}
$first = new Myclass;
echo $first->ReadFile();
?>
Answer the question
In order to leave comments, you need to log in
public function ReadFile() {
if($f = fopen("readit.txt", "r")) {
$this->fullText = fread($f, filesize("readit.txt"));
}
fclose($f);
return $this->fullText;
}
public function ReadFile() {
return file_get_contents("readit.txt");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question