Laravel-Automatic escape of $ _ request key for php http requests

Source: Internet
Author: User
For example, there is an http get request: {code ...} PHP automatically puts $ _ REQUEST [& quot; state. code & quot;] is escaped as $ _ REQUEST [& quot; state_code & quot;] an official note is as follows: {code ...} because the backend storage uses MongoDB, we hope to query json embedded data... for example, there is an http get request:

http://ask.segmentfault.com/api?state.code=16

PHP automatically escapes $ _ REQUEST ["state. code"] as $ _ REQUEST ["state_code"]

The official notes are as follows:

Dots and spaces in variable names are converted to underscores. For example  becomes $_REQUEST["a_b"].

Because the backend storage uses MongoDB, you want to query the data embedded in json. Therefore, you want to support the "point" query method. How should we solve this problem?

By the way, PHP's Web Framework uses Laravel.

Reply content:

For example, there is an http get request:

http://ask.segmentfault.com/api?state.code=16

PHP automatically escapes $ _ REQUEST ["state. code"] as $ _ REQUEST ["state_code"]

The official notes are as follows:

Dots and spaces in variable names are converted to underscores. For example  becomes $_REQUEST["a_b"].

Because the backend storage uses MongoDB, you want to query the data embedded in json. Therefore, you want to support the "point" query method. How should we solve this problem?

By the way, PHP's Web Framework uses Laravel.

http://ask.segmentfault.com/api?rq[state.code]=16/** PHP **/$_GET['rq']['state.code'];

It will not be converted in the array. Although it is troublesome, it is a solution...

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.