0
can someone explain this to me please!🤲
in php we can use the built-in include construct to include other documents in a page...if so then i tried to do this and i get the error i dont understand what went wrong include "http://127.0.0.1:8000/imgs/profile.png" i was doing this in my computer locally and i run two separate local servers at different ports. i tried to access an image from one server into another is that possible??
4 Respostas
+ 3
It looks like you want a PHP script to respond with a viewable PNG image.
The following should work better. Make sure you don't have even a single character printed before this runs. A single line break or space character will make the header call fail and the image's data invalid.
$file = 'http://127.0.0.1:8000/imgs/profile.png';
header('Content-Type: image/png'); // tell the browser that this can be shown instead of treating it like HTML.
echo file_get_contents($file);
+ 1
profile.png file seems to be an image not text file.
+ 1
Rafał Kołpak yes its an image, but an image is a file, is it possible to access it?
0
Josh Greig thanks josh it worked!