<i id='TYMXo'><tr id='TYMXo'><dt id='TYMXo'><q id='TYMXo'><span id='TYMXo'><b id='TYMXo'><form id='TYMXo'><ins id='TYMXo'></ins><ul id='TYMXo'></ul><sub id='TYMXo'></sub></form><legend id='TYMXo'></legend><bdo id='TYMXo'><pre id='TYMXo'><center id='TYMXo'></center></pre></bdo></b><th id='TYMXo'></th></span></q></dt></tr></i><div id='TYMXo'><tfoot id='TYMXo'></tfoot><dl id='TYMXo'><fieldset id='TYMXo'></fieldset></dl></div>
      <legend id='TYMXo'><style id='TYMXo'><dir id='TYMXo'><q id='TYMXo'></q></dir></style></legend>

      <tfoot id='TYMXo'></tfoot>
      • <bdo id='TYMXo'></bdo><ul id='TYMXo'></ul>
      1. <small id='TYMXo'></small><noframes id='TYMXo'>

        没有 .php 扩展名的 PHP URL 格式?

        PHP URL Format without .php extension?(没有 .php 扩展名的 PHP URL 格式?)

          <tfoot id='epBuf'></tfoot>

            <legend id='epBuf'><style id='epBuf'><dir id='epBuf'><q id='epBuf'></q></dir></style></legend>

                <bdo id='epBuf'></bdo><ul id='epBuf'></ul>

                  <small id='epBuf'></small><noframes id='epBuf'>

                • <i id='epBuf'><tr id='epBuf'><dt id='epBuf'><q id='epBuf'><span id='epBuf'><b id='epBuf'><form id='epBuf'><ins id='epBuf'></ins><ul id='epBuf'></ul><sub id='epBuf'></sub></form><legend id='epBuf'></legend><bdo id='epBuf'><pre id='epBuf'><center id='epBuf'></center></pre></bdo></b><th id='epBuf'></th></span></q></dt></tr></i><div id='epBuf'><tfoot id='epBuf'></tfoot><dl id='epBuf'><fieldset id='epBuf'></fieldset></dl></div>
                    <tbody id='epBuf'></tbody>
                • 本文介绍了没有 .php 扩展名的 PHP URL 格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要的只是获取一个字符串作为 URL 而不显示 PHP 文件名.我有文件 contact.php 页面我正在尝试获取 URL例如

                  all I need is to get a string as URL without showing the PHP filename. I have file contact.php page I am trying to get URL as e.g.

                  本地主机/联系人.php

                  localhost/contact.php

                  这就是我现在得到的我需要访问这个页面

                  this is what now I am getting I need to access this page just with

                  本地主机/联系人

                  对于每个页面,我应该只能通过它们的名称导航.

                  For every page I should able to navigate by their name only.

                  本地主机/联系人
                  本地主机/帮助
                  本地主机/支持

                  localhost/contact
                  localhost/help
                  localhost/support

                  推荐答案

                  如果您使用的是 apache,则需要使用 .htaccess 文件.如果您使用的是 IIS,那么您可以在 IIS 中进行配置.

                  You need to use an .htaccess file if you are using apache. If you are using IIS then you can configure it in IIS.

                  看看这个.

                  您的 .htaccess 文件需要如下所示:

                  Your .htaccess file would need to look something like this:

                  IndexIgnore * # prevent directory listing
                  
                  Order deny,allow
                  Allow from *
                  
                  # ------------------------------------------
                  # Rewrite so that php extentions are not shown
                  RewriteEngine on
                  
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteCond %{REQUEST_FILENAME}.php -f
                  RewriteRule ^(.*)$ $1.php
                  

                  由于文件限制,您不能在 windows 中简单地创建 .htaccess 文件,因此打开文本编辑器(Notepad ++ 或您的编程 IDE)并创建一个名为 .htaccess 的新文件.. 在文件名前面很重要.

                  You cannot simply create a .htaccess file in windows because of file constraints, so open a text editor (Notepad ++ or your programming IDE) and create a new file called .htaccess. The . is important in front of the file name.

                  编辑

                  不要有重复的文件名.IE contact.phpcontact.js 作为 htaccess 将不知道要提供哪个服务,哪个(取决于您的 apache)将返回一个错误页面,否则它只会提供其中一个.

                  Do not have duplicate file names. IE contact.php and contact.js as the htaccess will not know which one to serve, which (depending on your apache) will either return an error page or it will serve one of them only.

                  正如@AedixRhinedale 在下面的评论中指出的那样:

                  As @AedixRhinedale pointed out in the comments below:

                  只是来自 Apache 的注释:你如果您有权访问 httpd 主服务器配置文件,则应完全避免使用 .htaccess 文件.使用 .htaccess 文件会降低 Apache http 服务器的速度.您可以在 .htaccess 文件中包含的任何指令最好设置在 Directory 块中,因为它具有相同的效果并具有更好的性能

                  Just a note from Apache: You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance

                  这篇关于没有 .php 扩展名的 PHP URL 格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                • <i id='rx43W'><tr id='rx43W'><dt id='rx43W'><q id='rx43W'><span id='rx43W'><b id='rx43W'><form id='rx43W'><ins id='rx43W'></ins><ul id='rx43W'></ul><sub id='rx43W'></sub></form><legend id='rx43W'></legend><bdo id='rx43W'><pre id='rx43W'><center id='rx43W'></center></pre></bdo></b><th id='rx43W'></th></span></q></dt></tr></i><div id='rx43W'><tfoot id='rx43W'></tfoot><dl id='rx43W'><fieldset id='rx43W'></fieldset></dl></div>

                        <tbody id='rx43W'></tbody>
                      <tfoot id='rx43W'></tfoot>

                        <small id='rx43W'></small><noframes id='rx43W'>

                        <legend id='rx43W'><style id='rx43W'><dir id='rx43W'><q id='rx43W'></q></dir></style></legend>
                        • <bdo id='rx43W'></bdo><ul id='rx43W'></ul>