lollipop

A PHP-framework
Log | Files | Refs

commit 4a883ac674296b08a2d4793c3a4f18d3b3bb756b
parent 2edc648a2c0420efbdfeb295f64f7e4791dc8b89
Author: Friedel Schön <derfriedmundschoen@gmail.com>
Date:   Tue, 30 May 2023 12:01:18 +0200

fread -> file_get_contents

Diffstat:
MTemplate.php | 7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/Template.php b/Template.php @@ -6,13 +6,8 @@ use ErrorException; /* this function takes a uri and a string array data */ /* opens a stream to the uri specified file and stores the content in $file*/ - $filepointer = fopen($uri, "r") or die(throw new ErrorException("Unable to open file!", null, null, $uri)); - $filesize = filesize($uri); - $file = fread($filepointer,$filesize); - fclose($filepointer); - $tag = "<template>"; - return $this->insert_data($tag, $filesize, $file, $data); + return $this->insert_data($tag, file_get_contents($uri), $data); } private function insert_data(string $tag, int $filesize, string $file, array $data):string{ $tag_len = strlen($tag) - 1;