【发布时间】:2017-05-22 01:23:29
【问题描述】:
我有一个小问题。我需要通过数组变量索引一个 php 数组。
例子:
$structure = [];
$url = "/one/two/three";
$urlParts = explode("/", $url);
// I need convert $urlParts -> to array index ["one"]["two"]["three"]
// Expected result
$structure["one"]["two"]["three"] = true;
php语言可以吗?
【问题讨论】:
-
您想使用
.htaccess还是使用 PHP 本身? -
变量 $url 只是一个例子。我需要它用于 PHP 中的类似用例。