我一直在研究一个调色板系统,其中一个多维数组包含不同的调色板。前任:
$palette['1']['borderColor'] = "black";
$palette['2']['borderColor'] = "white";
我有一个函数在调用时应该返回一个调色板项目,但由于某种原因它没有返回任何东西。相反,它说“未定义的变量:调色板”EX:
$palette['1'] = array(
"borderColor"=> "#222222",
"divColor1"=> "#00f2ff",
"divColor2"=> "#222222",
"headerColor"=> "rgba(38, 38, 38, 0.5)",
"color1"=> "#00f2ff",
"color2"=> "#e9ffdd"
);
function getItem($number, $item) {
return $palette[$number][$item];
}
$borderColor = getItem('1', 'borderColor');
echo "borderColor is> " . $borderColor . " <.";
//returns "borderColor is> <."
有什么建议么?