我正在編寫一個應用程序,允許用戶修改和更改其某些網站設置。我只是構建一個表單生成器,將發送各種選項變化插件生成的代碼我想知道的是我應該使用對象而不是多維數組?如果是這樣,我將如何更改我的代碼?PHP對象或數組
所以現在我做了這個 - 它很長,而且會變得更長,所以我只貼一部分簡潔起見: -
$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
什麼是有這種最佳實踐的東西?
是的,其實聽起來不錯,我喜歡JSON ...;)我可以在php和js之間進行創作,我可能需要做...我想我會嘗試一下... – 2012-04-27 14:45:22