在 Linux 上的 Zend 配置 ini 文件中包含大括号内的变量
我试图通过用花括号括住一个变量来将其包含在 .ini 文件设置中,而 Zend 抱怨它无法在 Linux 上正确解析它。不过,它在 Windows 上工作正常:
welcome_message = Welcome, {0}.
这是在 Linux 上抛出的错误:
: Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /var/www/html/portal/application/configs/language/messages.ini on line 10
' in /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php:181
Stack trace:
0 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/var/www/html/p...')
1 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(125): Zend_Config_Ini->_loadIniFile('/var/www/html/p...')
2 /var/www/html/portal/library/Ingrain/Language/Base.php(49): Zend_Config_Ini->__construct('/var/www/html/p...', NULL)
3 /var/www/html/portal/library/Ingrain/Language/Base.php(23): Ingrain_Language_Base->setConfig('messages.ini', NULL, NULL)
4 /var/www/html/portal/library/Ingrain/Language/Messages.php(7): Ingrain_Language_Base->__construct('messages.ini', NULL, NULL, NULL)
5 /var/www/html/portal/library/Ingrain/Helper/Language.php(38): Ingrain_Language_Messages->__construct()
6 /usr/local/zend/share/ZendFramework/library/Zend/Contr in
如果我们用引号将大括号括起来,我们就能够在 Linux 上消除该错误,但这似乎是一个奇怪的解决方案:
welcome_message = Welcome, "{"0"}".
是否有为所有平台解决此问题的更好方法?谢谢你的帮助,
戴夫
I am trying to include a variable in a .ini file setting by surrounding it with curly braces, and Zend is complaining that it cannot parse it properly on Linux. It works properly on Windows, though:
welcome_message = Welcome, {0}.
This is the error that is being thrown on Linux:
: Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /var/www/html/portal/application/configs/language/messages.ini on line 10
' in /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php:181
Stack trace:
0 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(201): Zend_Config_Ini->_parseIniFile('/var/www/html/p...')
1 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(125): Zend_Config_Ini->_loadIniFile('/var/www/html/p...')
2 /var/www/html/portal/library/Ingrain/Language/Base.php(49): Zend_Config_Ini->__construct('/var/www/html/p...', NULL)
3 /var/www/html/portal/library/Ingrain/Language/Base.php(23): Ingrain_Language_Base->setConfig('messages.ini', NULL, NULL)
4 /var/www/html/portal/library/Ingrain/Language/Messages.php(7): Ingrain_Language_Base->__construct('messages.ini', NULL, NULL, NULL)
5 /var/www/html/portal/library/Ingrain/Helper/Language.php(38): Ingrain_Language_Messages->__construct()
6 /usr/local/zend/share/ZendFramework/library/Zend/Contr in
We are able to get the error to go away on Linux if we surround the braces with quotes, but that seems like a strange solution:
welcome_message = Welcome, "{"0"}".
Is there a better way to solve this issue for all platforms? Thanks for your help,
Dave
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在引号之间包含整个消息怎么样?
有点像这样:
Quoting the documentation of [`parse_ini_file`][1] *(which `Zend_Config_Ini` might use)* :
并且,还有(强调我的):
What about having the whole message between quotes ?
A bit like this :
Quoting the documentation of [`parse_ini_file`][1] *(which `Zend_Config_Ini` might use)* :
And, also (emphasis mine) :