比如有这样的一个http的get请求:
http://ask.segmentfault.com/api?state.code=16
PHP会自动把$_REQUEST["state.code"]转义为$_REQUEST["state_code"]
官方有这样的一个说明:
Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].
因为后端存储用的是MongoDB,所以希望能查询json内嵌的的数据,所以希望支持“点”这种方式的查询。针对这种问题应该如何解决呢?
顺便说下,PHP的Web Framework用的是Laravel。
立即学习“PHP免费学习笔记(深入)”;
比如有这样的一个http的get请求:
http://ask.segmentfault.com/api?state.code=16
PHP会自动把$_REQUEST["state.code"]转义为$_REQUEST["state_code"]
官方有这样的一个说明:
Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].
因为后端存储用的是MongoDB,所以希望能查询json内嵌的的数据,所以希望支持“点”这种方式的查询。针对这种问题应该如何解决呢?
顺便说下,PHP的Web Framework用的是Laravel。
立即学习“PHP免费学习笔记(深入)”;
http://ask.segmentfault.com/api?rq[state.code]=16 /** PHP **/ $_GET['rq']['state.code'];
在数组内是不会被转的,虽然麻烦了点,不过不失为一种解法…
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号