Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将Css文件拆分为多维数组_Php_Arrays - Fatal编程技术网

Php 将Css文件拆分为多维数组

Php 将Css文件拆分为多维数组,php,arrays,Php,Arrays,我有以下css代码 header{ color:#00F; font-weight:bold } /* This is some comment */ body{ font-size:11px; } 我想将其拆分为一个多维数组,如 Array ( [header] => array ( [color] => "#00F", [font-weight] => "bold" ) [body] => array ( [font

我有以下css代码

header{
  color:#00F; 
  font-weight:bold
}
/* This is some comment */
body{
  font-size:11px;
}
我想将其拆分为一个多维数组,如

Array (
  [header] => array (
    [color] => "#00F",
    [font-weight] => "bold"
  )
  [body] => array (
    [font-size] => "11px"
  )
)
我该怎么做呢


非常感谢

使用正则表达式解析它

对于“外部”块:[^{]+{[^}]+} 在每个选择器{…}表达式中包含文本后,请使用:[-\w]+:[^;]+


对于实际的代码,请使用

使用CSS解析器,如@alexn对不起,我的错