Php 代码无效,变成 HTML 评论
Php code not working, and turns into HTML comment
我有一个文件 "index.html"。并输入代码
<?php echo "Hello world"; ?>
但在浏览器中我可以看到:
<!--<?php echo "Hello world"; ?>-->
我使用 Microsoft-IIS/7.5 服务器,所以我不能使用 .htaccess 文件。
将您的文件另存为 index.php。 HTML 不读 PHP。
编辑:然后尝试更改主页 url。检查一下:
https://www.iis.net/configreference/system.webserver/defaultdocument
- // 这是一行 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 且用户为 rewrite module 的文件存储到 iis 中 link .html 文件到 .php 文件店铺。
通常用于 SEO 使用此方法。
我有一个文件 "index.html"。并输入代码
<?php echo "Hello world"; ?>
但在浏览器中我可以看到:
<!--<?php echo "Hello world"; ?>-->
我使用 Microsoft-IIS/7.5 服务器,所以我不能使用 .htaccess 文件。
将您的文件另存为 index.php。 HTML 不读 PHP。
编辑:然后尝试更改主页 url。检查一下:
https://www.iis.net/configreference/system.webserver/defaultdocument
- // 这是一行 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 且用户为 rewrite module 的文件存储到 iis 中 link .html 文件到 .php 文件店铺。 通常用于 SEO 使用此方法。