note 27716 added to function.file-get-contents
| From: | php-general at lists dot php dot net | Date: | Mon, 16 Dec 2002 20:15:35 +0000 |
| Subject: | note 27716 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40980@lists.php.net to get a copy of this message | ||
if your coding a script and you want to use the most efficient method available, a function like
this may help:
function template($templatename) {
if (!file_exists("./$templatename")) {
echo "Template <b>$templatename</b> does not exsist.";
exit;
}
if(function_exists('file_get_contents')) {
$tpl = file_get_contents($templatename);
}
else {
$tpl=join("\n", file("./$templatename"));
}
return $tpl;
}
--
http://www.php.net/manual/en/function.file-get-contents.php
http://master.php.net/manage/user-notes.php?action=edit+27716
http://master.php.net/manage/user-notes.php?action=delete+27716
http://master.php.net/manage/user-notes.php?action=reject+27716