1

我的 index.php 有问题,我有这个小脚本来决定要传递的内容

        <?php $clase = $_GET['clase'];
if ($clase == empresa) {include ("empresa.php");}
elseif ($clase == productos) {include("productos.php");}
else {include ($_SERVER['DOCUMENT_ROOT']."/inicio.html"); }
?>

当我去 www.mysite.com/index.php 它工作

但是当我访问 www.mysite.com 时,它并没有,我也想不出我们的原因。

4

3 回答 3

1

您缺少引号empresaproductos

<?php $clase = $_GET['clase'];
if ($clase == 'empresa') {include ("empresa.php");}
elseif ($clase == 'productos') {include("productos.php");}
else {include ($_SERVER['DOCUMENT_ROOT']."/inicio.html"); }
?>
于 2010-05-27T22:49:05.830 回答
1

检查服务器上的包含路径以确保 include() 可以找到 empresa.php 和 productos.php

于 2010-05-27T22:52:39.790 回答
1

需要设置您的服务器以识别默认索引。

我使用 Apache 并在 httpd.conf 文件中您想要更改DirectoryIndex.

这是我的副本:

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.htm index.html
</IfModule>
于 2010-05-28T00:28:15.753 回答