htaccess的URL路由的PHP MVC?

编程入门 行业动态 更新时间:2024-10-04 23:19:59
本文介绍了htaccess的URL路由的PHP MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在寻找,并还没有找到一篇文章,以帮助我。我很熟悉,当涉及到的htaccess的文件重写引擎,和我目前正在开发一个PHP MVC框架。

I've been searching and have yet to find an article to help me. I'm very unfamiliar when it comes to the rewrite engine of htaccess files, and am currently developing a php mvc framework.

基本上,从网络服务器的根目录下,我需要他们的控制器的所有页面请求/ url中的操作重定向到应用程序/ index.php的

Basically, from the root of the webserver, I need all page requests with their controllers / actions in the url to redirect to App/index.php

因此​​,例如site/Login/就直接到的index.php,和URI显然被解析用PHP来制定登录控制器通过后的数据。

So, for example site/Login/ would direct to the index.php, and the uri would obviously be parsed out with php to enact the login controller with passed post data.

推荐答案

我觉得'平常'的方式是转发的不存在的文件和目录到控制器的所有请求:

I think the 'usual' way is to forward all requests for non-existent files and directories to your controller:

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ App/index.php [L]

更多推荐

htaccess的URL路由的PHP MVC?

本文发布于:2023-11-02 06:35:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路由   URL   htaccess   PHP   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!