【问题标题】:Config load fails SMARTY配置加载失败 SMARTY
【发布时间】:2013-04-07 22:16:45
【问题描述】:

在我的 PHP 文件中使用

$smarty->config_load('en.conf');

我得到以下信息:

Notice: function call 'config_load' is unknown or deprecated. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_wrapper.php on line 57

然后我将语句更改为@$smarty->config_load('en.conf'); 并且错误被隐藏了。

然而,此时我所有的 ajax 脚本都失败了,并且在使用 firebug 的 ajax 响应中,这次我可以看到一个致命错误:

<b>Fatal error</b>:  Uncaught exception 'SmartyException' with message 'Unable to load config file &quot;en.conf&quot;' in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config.php:90
Stack trace:
#0 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config.php(39): Smarty_Internal_Config-&gt;buildConfigFilepath()
#1 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config.php(117): Smarty_Internal_Config-&gt;getConfigFilepath()
#2 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config.php(108): Smarty_Internal_Config-&gt;readConfigSource(Object(Smarty_Internal_Config))
#3 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config_file_compiler.php(44): Smarty_Internal_Config-&gt;getConfigSource()
#4 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_in in <b>C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ex\libs\sysplugins\smarty_internal_config.php</b> on line <b>90</b><br />

知道为什么我会收到第一个警告(例如,语法是否已更改)以及为什么会收到致命错误?

(Smarty 版本 3.0.8)

谢谢

【问题讨论】:

    标签: smarty smarty3


    【解决方案1】:

    configLoad 都是一个字所以$smarty-&gt;configLoad('en.conf'); 似乎解决了第一个错误,似乎该功能已在版本 3 中重命名

    【讨论】:

    • 关于第二个问题(ajax 脚本未加载)似乎我必须明确设置配置目录,这也解决了$smarty-&gt;setConfigDir('../configs');
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    • 2016-01-01
    相关资源
    最近更新 更多