What is the difference between php and html file extensions?

后端 未结 10 1697
无人共我
无人共我 2020-12-31 18:20

I am having a .php file with the following code. While I am changing the extension of the file as .html then also it is behaving in the same way. C

10条回答
  •  梦谈多话
    2020-12-31 18:34

    You can configure your web server to handle .php and .html files differently. Your webserver is configured to interpret both as PHP. Most servers handle .php as PHP, and serve .html as-is. That is, if you put your code in an HTML file, the PHP code will not run and will show up in the output.

    Some people find it nicer to have .html in the URL instead of .php. It may be useful if your users download your page and try opening them by double-clicking on them.

提交回复
热议问题