简体   繁体   English

PHP相当于asp.net路由

[英]PHP equivalent to asp.net routing

Is there an equivalent to ASP.NET routing in PHP. 是否有等效于PHP的ASP.NET路由。 I am working on an online math dictionary in PHP and can't find any equivalent to ASP.NET routing for PHP. 我正在使用PHP开发在线数学词典,找不到与PHP的ASP.NET路由等效的任何东西。 I want to be able to go to example.com/dictionary/word and have the word come up in a dynamically generated page from a database. 我希望能够转到example.com/dictionary/word并在数据库中动态生成的页面中显示该单词。 I have been trying to figure out how to make a file similar to the global.asax file in php but can't find what I want. 我一直试图找出如何使文件类似于php中的global.asax文件,但找不到我想要的文件。 Any help would be great 任何帮助都会很棒

Take a look at Aura.Router: 看一下Aura.Router:

https://github.com/auraphp/Aura.Router https://github.com/auraphp/Aura.Router

It allows you to do URL routing in PHP. 它允许您使用PHP进行URL路由。

This will require minimal URL rewriting setup. 这将需要最少的URL重写设置。

This isn't something you can do in PHP, but rather you are going to need to use the Apache ModRewrite module in a .htaccess file to configure your custom routing. 这不是您可以在PHP中执行的操作,而是需要在.htaccess文件中使用Apache ModRewrite模块来配置自定义路由。

Here is a good tutorial on how you can configure this: 这是一个很好的教程,介绍如何配置它:

http://code.tutsplus.com/tutorials/using-htaccess-files-for-pretty-urls--net-6049 http://code.tutsplus.com/tutorials/using-htaccess-files-for-pretty-urls--net-6049

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM