Save an html file as a file with the suffix aaa (or any other format) (for example, test. aaa), and when opened in the browser, it is found that the browser cannot be displayed in the form of a webpage, but test. the html source code in aaa is displayed. If it is saved as test.html... save an html file as a file with the suffix aaa (or any other format) (for example, test. aaa), and when opened in the browser, it is found that the browser cannot be displayed in the form of a webpage, but test. the html source code in aaa is displayed.
If it is saved as test.html, it is normal on the webpage.
For example, there are two files under the root directory of the Website: test.html and test. aaa.
The Code is as follows:
Access results:
http://127.0.0.1/test.aaa
==> Display webpage source code
http://127.0.0.1/test.html
==> Display a button
Q: How can a Browser display files in any format on a webpage?
Reply content:
Save an html file as a file with the suffix aaa (or any other format) (for example, test. aaa), and when opened in the browser, it is found that the browser cannot be displayed in the form of a webpage, but test. the html source code in aaa is displayed.
If it is saved as test.html, it is normal on the webpage.
For example, there are two files under the root directory of the Website: test.html and test. aaa.
The Code is as follows:
Access results:
http://127.0.0.1/test.aaa
==> Display webpage source code
http://127.0.0.1/test.html
==> Display a button
Q: How can a Browser display files in any format on a webpage?
Set http headerContent-Type: text/html
.
In addition, this should be related to your web service area, but it has nothing to do with php. For example, if you use nginx, you have.aaa
Change the MIME Type corresponding to the suffix file nametext/html
.