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

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

        Mod-Rewrite 还是 PHP 路由器?

        Mod-Rewrite or PHP router?(Mod-Rewrite 还是 PHP 路由器?)

          <tfoot id='iBPN0'></tfoot>
          • <legend id='iBPN0'><style id='iBPN0'><dir id='iBPN0'><q id='iBPN0'></q></dir></style></legend>

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

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

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

                1. 本文介绍了Mod-Rewrite 还是 PHP 路由器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I am debating routing my requests with one of the two options:

                  Option 1: simple capture route with Mod-Rewrite and funnel written $_GET route to index.php for loading...

                  #default routing
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule    ^blog/([0-9]+)?$    index.php?rt=blog&params=$1    [L,QSA]
                  // ..more custom routes, and then a default route
                  RewriteRule    ^([A-Za-z]+)/([A-Za-z]+)/(.*)?$    index.php?rt=$1/$2&params=$3    [L,QSA]
                  

                  Option 2: simply route requests to Front Controller, and create a PHP routing class to handle the routing...

                  #default routing
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
                  
                  /* --- on front controller, process $_GET['rt'] --- */
                  

                  at the end of the day, which will run faster, be easier to secure, and be easier to maintain?

                  any other ideas?

                  NOTE: I am not running a known framework. I am building my own MVC pattern to learn it.

                  解决方案

                  Usually in MVC frameworks, this sort of thing is usually best handled by a front controller (named index.php or the like). You use mod_rewrite to then hide index.php from all of the URLs so your users see nice clean paths.

                  It's also way easier to handle in PHP than in Apache's rewrite directives. PHP is much more flexible and easier to write/understand. I'm not sure I've ever seen mod_rewrite used as the sole routing engine for any web framework out there, now that I think of it.

                  Your second snip of code is the way to go for your rewrite directives.

                  这篇关于Mod-Rewrite 还是 PHP 路由器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

                    1. <tfoot id='VV5dV'></tfoot>
                      <legend id='VV5dV'><style id='VV5dV'><dir id='VV5dV'><q id='VV5dV'></q></dir></style></legend>

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

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