. htaccess-How to implement the PHP route distribution method variable custom parameter name and number

Source: Internet
Author: User
Tags php framework
For example, there is a method public function A ($b, $c, $d) {
Echo $b, $c, $d;
}

要输入的链接是.......&b=1&c=2&d=3然后输出123这个该在.htaccess怎样写

Reply content:

For example, there is a method public function A ($b, $c, $d) {
Echo $b, $c, $d;
}

要输入的链接是.......&b=1&c=2&d=3然后输出123这个该在.htaccess怎样写

This is the URL parameter, basically all the routes will not be processed querystring, and in fact, it is not scientific. So I think what you need is func_get_args() this function, the route as long as the control to turn the URL to a() this function is good, and then just do this:

public function a() {    return implode(",", func_get_args());}

Personally think you've started to need restful APIs.

Recommended reference for RESTful API design best practices

The relevant PHP framework I recommend slimphp. Reference documents

  • 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.