php和html文件扩展名有什么区别? [英] What is the difference between php and html file extensions?
问题描述
我有一个 .php
文件,其代码如下。当我将文件的扩展名更改为 .html
时,它的行为方式也是相同的。任何人都可以解释以下内容:
- 为什么文件的行为与
的两个扩展名相同? -
.php
和.html
文件扩展名之间的区别是什么?
.php
档案
< HTML>
< head>
<! - 一些html代码 - >
< / head>
< body>
<?php echo你好! ?>
< / body>
< / html>
filetype只是识别文件的一种方式,你不能总是信任它们。
根据你的web服务器配置,你会看到不同的结果。
.html通常只用于没有服务器端代码的HTML。
.php用于服务器端php代码和html。
它们可以用于任何事情,它只取决于设置。
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. Can anyone explain the following:
- Why the file is behaving in the same manner with both the extensions?
- What is the difference between the
.php
and.html
file extensions?
.php
file
<html>
<head>
<!-- some html code -->
</head>
<body>
<?php echo "Hello!" ?>
</body>
</html>
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.
这篇关于php和html文件扩展名有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!