2013-11-26 29 views
0

我已經通過以下this example將我的應用程序設置爲使用模塊配置xml。ZF2:在XML配置文件中定義空數組

現在我需要爲一個配置鍵定義一個空數組。等效的PHP配置文件將是:

<?php 
return array (
    //...the other configurations 
    'sample' => array(
    'empty' => array() 
) 
); 

我想不出如何在xml中建立這個。 如果我嘗試下面的XML解析器返回一個空字符串,但我需要一個空數組。

<?xml version="1.0" encoding="UTF-8"?> 
<zend-config> 
    <!-- ...the other configurations --> 
    <sample> 
     <empty></empty> 
    </sample> 
</zend-config> 

有沒有一個選項,我可以強制Zend \ Config \ Factory返回一個數組而不是一個字符串?

回答

1

您的意思是?

<zend-config> 
    <sample> 
     <empty/> 
    </sample> 
</zend-config> 
+0

謝謝!這就是解決方案。 – P0rnflake