Php代码不工作,并转换为HTML注释

Php代码不工作,并转换为HTML注释,php,iis-7.5,Php,Iis 7.5,我有一个文件“index.html”。还有一个密码 <?php echo "Hello world"; ?> 但在浏览器中,我可以看到: <!--<?php echo "Hello world"; ?>--> 我使用Microsoft IIS/7.5server,因此无法使用.htaccess文件 将文件另存为index.php。HTML不读取PHP 编辑:然后尝试更改主url。看看这个: 将文件另存为index.php。HTML不读取PHP 编辑

我有一个文件“index.html”。还有一个密码

<?php echo "Hello world"; ?>

但在浏览器中,我可以看到:

<!--<?php echo "Hello world"; ?>-->


我使用Microsoft IIS/7.5server,因此无法使用.htaccess文件

将文件另存为index.php。HTML不读取PHP

编辑:然后尝试更改主url。看看这个:


将文件另存为index.php。HTML不读取PHP

编辑:然后尝试更改主url。看看这个:

< LI>//这是一个C++语言风格的注释 范例

<?php
// This is a single line commment.
$comment = 1;

/* This is a multi line comment
       yet another line of comment */
$comment = "many lines";

?>

< LI>//这是一个C++语言风格的注释 范例

<?php
// This is a single line commment.
$comment = 1;

/* This is a multi line comment
       yet another line of comment */
$comment = "many lines";

?>

您可以使用.php扩展名存储文件,并在iis中使用户将.html文件链接到您存储的.php文件。
通常用于使用此方法进行SEO。

您可以使用.php扩展名存储文件,并在iis中使用户将.html文件链接到您存储的.php文件。
通常用于使用此方法进行SEO。

尝试将您的文件重命名为
index.php
。如果我重命名,则一切正常。但是我需要.html扩展名为什么需要
.html
?它在
.html
文件中不起作用,因为它不是html。可能有一些信息,请尝试将您的文件重命名为
index.php
。如果我重命名,一切正常。但是我需要.html扩展名为什么需要
.html
?它在
.html
文件中不起作用,因为它不是html。我可能有一些信息