Php 为什么打印配置数组会给出空数组?
它回来了Php 为什么打印配置数组会给出空数组?,php,smarty,Php,Smarty,它回来了 $tpl = new Smarty(); $tpl->configLoad('compose.conf'); $config = $tpl->getConfigVars(); print_r($config); 怎么了,我做错了 compose.conf Array() 根据本手册: 注意:有些保留字不能用作ini文件的键。这些包括:null,yes,no,true,false,>>在smarty插件目录中 smarty_internal_config.php 搜索状
$tpl = new Smarty();
$tpl->configLoad('compose.conf');
$config = $tpl->getConfigVars();
print_r($config);
怎么了,我做错了
compose.conf
Array()
根据本手册:
注意:有些保留字不能用作ini文件的键。这些包括:
null
,yes
,no
,true
,false
,>>在smarty插件目录中
smarty_internal_config.php
搜索状态
if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
// ^^
现在将此语句替换为
if (!empty($sections)) {
在加载文件时,请像这样使用它
if($sections=='*'){
foreach ($_config_vars['sections'] as $key=>$value) {
if (isset($value['vars'])) {
$scope_ptr->config_vars[$key] = $value['vars'];
}
}
} else if (!empty($sections)) {
就是这样:)compose.conf包含什么?它包含配置变量,请参见编辑。错误日志中是否有任何内容?也许您的意思是调用config\u load
而不是configLoad
?conpose.conf
与compose.conf
不同,但这可能只是一个输入错误。@h2ooooooo是的typo@LNT在bootstrap_js
下还有一个:ON=jquery
if($sections=='*'){
foreach ($_config_vars['sections'] as $key=>$value) {
if (isset($value['vars'])) {
$scope_ptr->config_vars[$key] = $value['vars'];
}
}
} else if (!empty($sections)) {
$tpl = new Smarty();
$tpl->configLoad('compose.conf','*');
$config = $tpl->getConfigVars();
print_r($config);