What is the difference between php and html file extensions?

后端 未结 10 1636
无人共我
无人共我 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:41

    As far as I Know, depending on the extension the web server will process your file on one way or another. Also, for example, you could have a PHP file that doesn't generate any HTML output, but it redirects to another file.

    If you want to give a *.html ended page, you could do it programatically.

    0 讨论(0)
  • 2020-12-31 18:46

    The filetype is just a way to identify the file, you can't always trust them.

    Depending on your web server configuration, you will see different results.

    .html is generally use just for html with no serverside code.

    .php is used for serverside php code and html if required.

    They can be used for anything, it just depends on the setup.

    0 讨论(0)
  • 2020-12-31 18:49

    php is a server side scripting language. Every thing that have a tag php

    will be generated by the server and put in the html response.

    0 讨论(0)
  • 2020-12-31 18:51

    you can set any extension to be parsed as PHP, so difference in your case is only in extension. If you disable html files in your Apache configuration to be parsed as php than content of file won't be parsed by PHP. That is all

    For example you can add any extension in your Apache configuration to be parsed by php, like this

    application/x-httpd-php myextension
    

    where myextension is extension of the file you want to parse.

    0 讨论(0)
提交回复
热议问题