我正在编写一个应用程序,允许用户修改和更改他们的一些网站设置.我只是构建一个表单生成器,它将各种选项发送到各种插件来生成代码,我想知道我是否应该使用对象而不是多维数组?如果是这样,我将如何更改我的代码?
所以现在我做了这个 – 它很长很长,所以我只是为了简洁而粘贴了一部分: –
- $scopeSettings = array(
- 'site_background' => array(
- 'subpanels' => array(
- 'colour' => array(
- 'plugins' => array(
- 'colourchooser' => array(
- 'tip' => "The background colour appears underneath the 'Background Image' (if set)-hover over the '?' around the colour chooser for extra tips on how to use it",'element' => 'body','gradientenabled' => 'true','opts' => array (
- 'closed' => 'true','advanced' => array(
- 'tip' => "You can paste in your own generated gradient codes in here",'checkBox' => true
- )//end advanced
- )//end Opts
- )//end colour chooser
- )//end plugins
- ),//end colour sub panel
- 'pattern' => array(
- 'plugins' => array(
- 'patternselector' => array(
- 'tip' => "Use the pattern selector to apply effects like moire or scan lines to your background image",'element' => 'patimg'
- )//end patternselector
- )//end plugins
- ),//end pattern sub panel
- )//end subpanels
- )//end site background
- );//end scope settings
这种事情最好的做法是什么?
也许这是愚蠢的,但您可以使用“YAML”或“JSON”作为应用程序的配置格式吗?
例如Symfony或其他框架.