note 128902 added to function.file-get-contents
| From: | info at carlosvega dot net | Date: | Wed, 20 Sep 2023 14:20:59 +0000 |
| Subject: | note 128902 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220862@lists.php.net to get a copy of this message | ||
I have had some troubles when I needed to access to a existing file which returns 404 response
(accessing to "https://yourdomain.com/404.html", for
instance).
Code example:
if (your route doesn't exist) {
add header 404
show file_get_contents("https://yourdomain.com/404.html")
}
file_get_contents returned the content of the file, but it undestood the file didn't exist as
well so it showed a warning.
I had to use relative paths ("./404.html").
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 90.69.93.105)
----
Manual Page -- https://php.net/manual/en/function.file-get-contents.php
Edit -- https://main.php.net/note/edit/128902
Del: integrated -- https://main.php.net/note/delete/128902/integrated
Del: useless -- https://main.php.net/note/delete/128902/useless
Del: bad code -- https://main.php.net/note/delete/128902/bad+code
Del: spam -- https://main.php.net/note/delete/128902/spam
Del: non-english -- https://main.php.net/note/delete/128902/non-english
Del: in docs -- https://main.php.net/note/delete/128902/in+docs
Del: other reasons-- https://main.php.net/note/delete/128902
Reject -- https://main.php.net/note/reject/128902
Search -- https://main.php.net/manage/user-notes.php