php – 在Linux上的Zend config ini文件中包含大括号内的变量
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – 在Linux上的Zend config ini文件中包含大括号内的变量,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1942字,纯文字阅读大概需要3分钟。
内容图文
![php – 在Linux上的Zend config ini文件中包含大括号内的变量](/upload/InfoBanner/zyjiaocheng/970/9ce64bf0f27046be8466f4c417f8f5cd.jpg)
我试图通过用大括号括起来在.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"}".
有没有更好的方法来解决所有平台的这个问题?谢谢你的帮助,
戴夫
解决方法:
如何在引号之间传递整个消息?
有点像这样:
welcome_message = "Welcome, {0}."
引用parse_ini_file(Zend_Config_Ini可能使用的)的文档:
Note: If a value in the ini file
contains any non-alphanumeric
characters it needs to be enclosed in
double-quotes ("
).
而且,(强调我的):
Note: There are reserved words which
must not be used as keys for ini
files.
These include:null
,yes
,no
,
true
,false
,on
,off
,none
.
Values
null
,no
andfalse
results in""
, yes
and true results in"1"
.
Characters
{}|&~![()^"
must not be used
anywhere in the key and have a
special meaning in the value.
内容总结
以上是互联网集市为您收集整理的php – 在Linux上的Zend config ini文件中包含大括号内的变量全部内容,希望文章能够帮你解决php – 在Linux上的Zend config ini文件中包含大括号内的变量所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。