Php 404错误页面上的回显URL

Php 404错误页面上的回显URL,php,http-status-code-404,Php,Http Status Code 404,我想要一个404页面来编写“/fake/path/index.php”中的页面找不到,但它 始终写入找不到“/404/index.php”处的页面。(/404/index.php是错误 文件)。如何访问正在访问的路径(/fake/path/index.php)?(我正在使用.htaccess错误文档404) .htaccess: ErrorDocument 404 /404/ /404/index.php: <html> <head> <meta ch

我想要一个404页面来编写
“/fake/path/index.php”中的页面找不到
,但它 始终写入
找不到“/404/index.php”处的页面
。(/404/index.php是错误 文件)。如何访问正在访问的路径(/fake/path/index.php)?(我正在使用.htaccess错误文档404)

.htaccess:

ErrorDocument 404 /404/
/404/index.php:

<html>
  <head>
    <meta charset="UTF-8" />
    <title>404 Error</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script src="/js/jquery-2.0.3.js"></script>
    <script src="/js/jquery-ui-1.10.3.js"></script>
    <script src="/js/script.js"></script>
  </head>
  <body>
    <div id="content">
      <h1 id="page_title" style="text-align: center;">404 Error - Not Found</h1>
      <span style="font-size: 14px; color: black;">
        The page at "<a href="$dir"><?php echo $_SERVER['PHP_SELF']; ?></a>" could not be found.  Possible causes of this are:
      </span>
    </div>
  </body>
</html>

404错误
404错误-未找到
找不到“”处的页面。可能的原因有:

您的问题是您正在查询
$\u服务器['PHP\u SELF']
它将返回
/404/index.php
,因为这是文件名

您想要的是使用
请求URI

<span style="font-size: 14px; color: black;">
        The page at "<a href="$dir"><?php echo $_SERVER['REQUEST_URI']; ?></a>" could not be found.  Possible causes of this are:
      </span>

找不到“”处的页面。可能的原因有:

您可以给我们看一下您的
.htaccess
/404/index.php
文件。是的,这很有效。我不知道那件事。谢谢@user3238291非常好:-)您应该始终阅读php手册-。(使事情变得容易多了;-)