【发布时间】:2014-03-21 15:31:42
【问题描述】:
我有 xampp,我有一个扩展项目 *。 html 和 php 代码有我的本地主机 php 不会解释代码并将其显示为 php,但我想作为 php 代码运行: index.html
<?php
$seccion='inicio';
require_once("idiomas.html");
require_once("configurador.html");
require_once("header_scripts_css.html");
?>
<body class="clearfix">
<header id="header">
<?php require_once("header.html"); ?>
</header>
<?php require_once("slider.html"); ?>
<div id="centro">
<?php require_once("central.html");?>
</div>
<?php require_once("footer.html"); ?>
【问题讨论】:
-
您不能在 .html 文件中运行 PHP。
-
@TomKriek 是的,你可以。如果您在正确的位置查找,PHP 将处理您要求它处理的任何文件。
-
@TomKriek:如果您告诉服务器通过 PHP 处理
.html文件,则可以。 -
为什么不把文件扩展名改成 *.php 呢?
-
@Tim Cooper 试过这个但在 htaccess 中不起作用认为它与 httpd.conf 和 mime.types 文件有关