为了正确使用 Smarty,我创建了一个配置文件。文件结构是这样的:
/Smarty/
/Smarty/cache
/Smarty/configs
/Smarty/configs/main.conf
/Smarty/plugins
/Smarty/sysplugins
/Smarty/templates_c
/templates/
/templates/main.tpl
index.php
在 main.tpl 我尝试通过以下方式从 /Smarty/configs/main.conf 加载 main.conf:
{config_load "main.conf"}
如下所述:http ://www.smarty.net/docs/en/language.config.variables.tpl
这没有'不起作用(“致命错误:未捕获的异常'SmartyException'带有消息'无法读取配置文件'main.conf''在......”),但这确实有效:
{config_load "/var/www/vhosts/*domain*/subdomains/cms/httpdocs/Smarty/configs/main.conf"}
为什么第一个示例不起作用?我之前确实通过以下方式设置了配置目录:
$smarty->setConfigDir(SMARTY_DIR.'configs/');
但是找不到配置目录。有人可以帮我吗?提前致谢!