Phpurl pseudo-static bridging analysis

Source: Internet
Author: User
Phpurl pseudo-static parsing 1. do you want to talk about URL ing ?? Generally, there are two methods for url Ing. one is implemented through mod_rewrite. I will not talk about this online course material much more. Another method is to simulate in the program, such as the method in zendFramework,/index. php/controller/acti php url pseudo-static parsing.

1. let's talk about URL ING.
? ? Generally, there are two methods for url Ing. one is implemented through mod_rewrite. I will not talk about this online course material much more. Another method is to simulate it in a program, such as the method in zend Framework,/index. php/controller/action/var1/value1/var2/value2 /. The formula here is mainly to use a unified input interface, parse the url, and finally forward it to the module in the corresponding controller.

? ? I have written two simple functions here for simulation.
? ? The first function is mainly to parse the address, and put something similar to/index. the address of php/controller/action/var1/value1/var2/value2/is parsed into three parts: controller, module, and params.

  

Here we will complete the main url parsing function, and then forward Ing. the following function implementation (note that the implementation of this function is based on my own architecture, so you need to modify it accordingly. of course, if your MVC is similar to the zend Framework, you should not need much .)

 _ SetParam ($ router ['params']); $ controller-> {$ router ['action']. 'action'} (); return true ;}?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.