其他人说,PHP只打开索引文件;不存在,即使它们存在

其他人说,PHP只打开索引文件;不存在,即使它们存在,php,.htaccess,include,Php,.htaccess,Include,所以,我正在制作一个网站,并将其与index.php文件中的includes放在一起。 问题是,该网站打开并完美地显示了第一页,但没有一种语言链接起作用! 这是我的密码: 索引文件: <?php $languages = array("eng","lat"); $sections = array("home"); $sectionTitles = array("eng" =>array( "WHERE CAN YOU FIND US?", "W

所以,我正在制作一个网站,并将其与index.php文件中的includes放在一起。 问题是,该网站打开并完美地显示了第一页,但没有一种语言链接起作用! 这是我的密码:

索引文件

<?php
    $languages = array("eng","lat");
    $sections = array("home");
    $sectionTitles = array("eng" =>array(
    "WHERE CAN YOU FIND US?",
    "WHO ARE WE?",
    "CONTACTS",
    ), 
        "lat"=>array(
                "KUR MŪS ATRAST?",
            "PAR MUMS",
            "KONTAKTI",
            ));

$lang = "lat";
$section = "home";

$content = explode("/", $_SERVER['REQUEST_URI']);

if (!empty($content[1]) && (in_array($content[1], $languages))) { $lang = $content[1];}
if (!empty($content[2]) && (in_array($content[2], $sections))) { $section = $content[2];}
$sectionTitles = $sectionTitles[$lang];

include ("header.php");
include ("$lang/$section.php");
include ("footer.php");

?>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !\.(php|css|js|gif|png|jpe?g|pdf|eot|svg|ttf|woff|ico)$
    RewriteRule (.*)$ /index.php [L]
    <a href="/eng/<?=$section?>">eng</a>
我的头文件中的链接

<?php
    $languages = array("eng","lat");
    $sections = array("home");
    $sectionTitles = array("eng" =>array(
    "WHERE CAN YOU FIND US?",
    "WHO ARE WE?",
    "CONTACTS",
    ), 
        "lat"=>array(
                "KUR MŪS ATRAST?",
            "PAR MUMS",
            "KONTAKTI",
            ));

$lang = "lat";
$section = "home";

$content = explode("/", $_SERVER['REQUEST_URI']);

if (!empty($content[1]) && (in_array($content[1], $languages))) { $lang = $content[1];}
if (!empty($content[2]) && (in_array($content[2], $sections))) { $section = $content[2];}
$sectionTitles = $sectionTitles[$lang];

include ("header.php");
include ("$lang/$section.php");
include ("footer.php");

?>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !\.(php|css|js|gif|png|jpe?g|pdf|eot|svg|ttf|woff|ico)$
    RewriteRule (.*)$ /index.php [L]
    <a href="/eng/<?=$section?>">eng</a>


提前谢谢你

将htaccess文件更改为

RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|css|js|gif|png|jpe?g|pdf|eot|svg|ttf|woff|ico)$
RewriteRule (.*)$ /index.php?_url=$1 [L]
然后你可以用

$content = explode("/", $_GET['_url']);

print_r($content)怎么说?数组([0]=>[1]=>)那么,我该如何解决这个问题呢(好的,这意味着要么$_SERVER['REQUEST_URI']为空,要么您的web服务器存在一些配置问题,要么它包含一些意外的内容。当我更改指向它的链接时,它会说该文件不存在,即使它存在。谢谢,@colburton,将与我的服务器人员联系。非常感谢,我将向我的服务器人员展示此内容。