PHP对象或数组

前端之家收集整理的这篇文章主要介绍了PHP对象或数组前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在编写一个应用程序,允许用户修改和更改他们的一些网站设置.我只是构建一个表单生成器,它将各种选项发送到各种插件生成代码,我想知道我是否应该使用对象而不是多维数组?如果是这样,我将如何更改我的代码

所以现在我做了这个 – 它很长很长,所以我只是为了简洁而粘贴了一部分: –

  1. $scopeSettings = array(
  2. 'site_background' => array(
  3. 'subpanels' => array(
  4. 'colour' => array(
  5. 'plugins' => array(
  6. 'colourchooser' => array(
  7. '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 (
  8. 'closed' => 'true','advanced' => array(
  9. 'tip' => "You can paste in your own generated gradient codes in here",'checkBox' => true
  10. )//end advanced
  11. )//end Opts
  12. )//end colour chooser
  13. )//end plugins
  14. ),//end colour sub panel
  15. 'pattern' => array(
  16. 'plugins' => array(
  17. 'patternselector' => array(
  18. 'tip' => "Use the pattern selector to apply effects like moire or scan lines to your background image",'element' => 'patimg'
  19. )//end patternselector
  20. )//end plugins
  21. ),//end pattern sub panel
  22. )//end subpanels
  23. )//end site background
  24. );//end scope settings

这种事情最好的做法是什么?

也许这是愚蠢的,但您可以使用“YAML”或“JSON”作为应用程序的配置格式吗?

例如Symfony或其他框架.

猜你在找的PHP相关文章