我怎么能建立一个以下字符串数组:
$scope = "calls:full,departments:full,employees:full,companies:full,stages:full,accounts:full,resources:full,products:full,reports:full";
Run Code Online (Sandbox Code Playgroud)
像这样代表它:
$scope = array(
'calls' => full,
'departments' => full,
'employees' => full,
.... and so on >>
);
Run Code Online (Sandbox Code Playgroud)
$scope = "calls:full,departments:full,employees:full,companies:full,stages:full,accounts:full,resources:full,products:full,reports:full";
$parts = explode(',', $scope);
$arr = array();
foreach($parts as $val) {
list($key, $value) = explode(':', $val);
$arr[$key] = $value;
}
Run Code Online (Sandbox Code Playgroud)