include 和 Get 不适用于索引
我的 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 时它不起作用,我无法弄清楚我们为什么。
I have a problem with my index.php, i have this small script that decides what content to deliver
<?php $clase = $_GET['clase'];
if ($clase == empresa) {include ("empresa.php");}
elseif ($clase == productos) {include("productos.php");}
else {include ($_SERVER['DOCUMENT_ROOT']."/inicio.html"); }
?>
it works when i go to www.mysite.com/index.php
but when i go to www.mysite.com it doesnt and i cant just figure our why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
需要设置您的服务器以识别默认索引。
我使用 Apache,并且在 httpd.conf 文件中您需要更改
DirectoryIndex
。这是我的副本:
Need to set your server up to recognize default index's.
I use Apache and in the httpd.conf file you would want to change the
DirectoryIndex
.Here is my copy:
您缺少关于
empresa
和productos
的引号:You are missing quotes around
empresa
andproductos
:检查服务器上的包含路径,以确保 include() 可以找到 empresa.php 和 Productos.php
Check the include path on your server to ensure that include() can locate empresa.php and productos.php