2
我有一个ini文件是这样的:选择随机项从对象
[hints]
menu.0 = "Hint: Dropping a element on parent element will move the selected element at the end of list!"
menu.1 = "Hint: Use Menu elements to beautify your navigator!"
menu.2 = "Hint: Pages in red means they are draft pages. Adding them to your menu means that your visitors can not see the page!"
和阅读使用Zend_Config_Ini的ini文件:
self::$hints = new Zend_Config_Ini(APPLICATION_PATH . '/configs/hints.ini',
'hints');
上var_dump(self::$hints->menu);
输出是:
object(Zend_Config)[63]
protected '_allowModifications' => boolean false
protected '_index' => int 0
protected '_count' => int 3
protected '_data' =>
array (size=3)
0 => string 'Hint: Dropping a element on parent element will move the selected element at the end of list!' (length=93)
1 => string 'Hint: Use Menu elements to beautify your navigator!' (length=51)
2 => string 'Hint: Pages in red means they are draft pages. Adding them to your menu means that your visitors can not see the page!' (length=118)
protected '_skipNextIteration' => null
protected '_loadedSection' => null
protected '_extends' =>
array (size=0)
empty
protected '_loadFileErrorStr' => null
我需要帮助,随机从该对象中挑选一个项目并显示它。
如果我使用的是数组,但是我有一个对象,它会工作。 – CGeorges
当然。我用更多信息更新我的答案。 – zipser
是的,谢谢,应该解决它。只有一个问题我有更多的,我不知道如何访问该对象的_data,因为它受到保护,任何想法? – CGeorges