Is there a way I can echo the whole content of a .html file in PHP?
For example, I have some sample.html file, and I want to echo that filename, so its content should be displayed.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should use
readfile():This will read the file and send it to the browser in one command. This is essentially the same as:
except that
file_get_contents()may cause the script to crash for large files, whilereadfile()won’t.