• <small id='H6zZ1'></small><noframes id='H6zZ1'>

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

      <tfoot id='H6zZ1'></tfoot>

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

        .htaccess 替换(重写)PHP URL 中的 $_GET 变量

        .htaccess replace (rewrite) $_GET variables in PHP URL(.htaccess 替换(重写)PHP URL 中的 $_GET 变量)
      1. <tfoot id='DJKKm'></tfoot>

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

          • <small id='DJKKm'></small><noframes id='DJKKm'>

                  <legend id='DJKKm'><style id='DJKKm'><dir id='DJKKm'><q id='DJKKm'></q></dir></style></legend>
                  本文介绍了.htaccess 替换(重写)PHP URL 中的 $_GET 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个类似于 example.com/index.php?p=test 的 URL,以便 PHP 将使用 $_GET['p'] 加载测试变量.URL 已经可以简化为 example.com?p=test;但是,我希望在我的 .htaccess 中将其简化为 site.com/test.我该怎么做?

                  I have a URL that will be something like example.com/index.php?p=test so that the PHP will load the test variable using $_GET['p']. The URL can already be simplified to example.com?p=test; however, I wish to simplify this in my .htaccess to site.com/test. How would i go about doing this?

                  推荐答案

                  将以下内容放入您的 .htaccess 文件中:

                  Place the following in your .htaccess file:

                  RewriteEngine on
                  
                  # The two lines below allow access to existing files on your server, bypassing
                  # the rewrite
                  
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  
                  RewriteRule (.*) index.php?p=$1 [QSA]
                  

                  然后您可以从 example.com/whatever 访问 whatever,如下所示:

                  You can then access whatever from example.com/whatever like the following:

                  $value = $_GET['p']; // "whatever"
                  

                  这篇关于.htaccess 替换(重写)PHP URL 中的 $_GET 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)

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

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

                      • <bdo id='afdBX'></bdo><ul id='afdBX'></ul>

                          1. <tfoot id='afdBX'></tfoot>