我将试图弄清楚如何保护目录免受未经授权或未被识别的用户下载文件.提前致谢.
我有一个查询字符串:
"condition=good;condition=not-good&features=ABS&features=ESP&features=ENT&brand=Honda&model=Traffic"
Run Code Online (Sandbox Code Playgroud)
*请注意重复参数
我使用此函数转换和 - 得到重复键 - 到数组:
function proper_parse_str($str) {
# result array
$arr = array();
# split on outer delimiter
$pairs = explode('&', $str);
# loop through each pair
foreach ($pairs as $i) {
# split into name and value
list($name,$value) = explode('=', $i, 2);
# if name already exists
if( isset($arr[$name]) ) {
# stick multiple values into an array
if( is_array($arr[$name]) ) {
$arr[$name][] = $value;
}
else {
$arr[$name] = array($arr[$name], $value);
}
} …Run Code Online (Sandbox Code Playgroud)