【问题标题】:xampp directly open my html filexampp直接打开我的html文件
【发布时间】:2016-08-02 18:17:25
【问题描述】:

我创建了名为 en407 的文件夹,并在其中创建了一个名为 assigment 的文件,其中包含 html、css 和 php。

http://localhost/en407b/



当我点击 assginmnt 文件时,我应该让我选择要打开的文件

http://localhost/en407b/assignment

但链接直接转到我的 html 文件 index.html 并且链接仍然存在

http://localhost/en407b/assignment

在我的作业文件中,它包含 index.html 、 index2.html 和其他......

怎么解决???

【问题讨论】:

    标签: xampp


    【解决方案1】:

    起初你不能在 .html 文件中运行 PHP,因为在你告诉它这样做之前,服务器不会识别它是有效的。为此,请在您的 Web 根目录中创建一个 .htaccess 文件,并在其中添加以下行:

    AddType application/x-httpd-php .htm .html
    

    这将告诉 Apache 将具有 .htm 或 .html 文件扩展名的文件作为 PHP 文件处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 2020-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-12
      相关资源
      最近更新 更多