使清洁的URL和检索查询字符串 [英] Make clean URLS and retrieve query string

查看:148
本文介绍了使清洁的URL和检索查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有插入在PHP code相对URL,如办法/论坛/(forumID)/ 成标签,同时建立我的网站?然后,当我试图让这forumID当前页面,通过 $ _ GET 要求得到它不使用模板系统像智者,CakePHP的等或Apache重写模块?或者它是一个巨大的头痛?我只是希望能够不被绑定到一个Web服务器类型(阿帕奇)。

Is there a way to insert relative URLS in php code such as /forums/(forumID)/ into tags while setting up my site? Then when I am trying to get which forumID the current page is, to get it via a $_GET request without using a template system like Smarty, CakePHP etc or Apache rewrite module? Or is it a huge headache? I just want to be able to not be bound to one web server type (Apache).

推荐答案

...从OP意见进行的。

... carried on from OP comments.

这些框架在各自的语言再次读取请求,以允许框架路由到特定的控制器,但他们仍然需要网络服务器设置为发送请求到框架摆在首位。

These frameworks read the request again in their respective languages to allow the framework to route to specific controllers, but they still need the webserver to be setup to send the request to the framework in the first place.


  • 客户端请求 http://example.com/forums/123

  • DNS查找后,请求到达服务器在127.0.0.1:80

  • 网络服务器(例如Apache)侦听80端口,并接受请求

  • 阿帕奇路线请求,服务器端脚本

这是旅程作为Web服务器看到它。它需要读取请求它甚至命中服务器端脚本语言(PHP / Python的/红宝石等)之前。

This is the journey as the web server sees it. It needs to read the request before it even hits the server-side scripting language (PHP/Python/Ruby etc).

服务器端语言可以重新读取URL一旦web服务器已经达到了前端控制器,因为他们请。

The server-side languages can then re-read the URL once the webserver has hit the front controller as they please.

这篇关于使清洁的URL和检索查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆