require smarty.class.php 报错,Smarty 报错
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
temp.tpl:{config_load file="../configs/a.conf"}{#s#}
a.conf:s='測試測試'
報錯Fatal error: Uncaught exception 'SmartyException' with message 'Unable to read config file '../configs/a.conf'' in C:\wamp\www\smarty\libs\sysplugins\smarty_internal_resource_file.php:68 Stack trace: #0 C:\wamp\www\smarty\libs\sysplugins\smarty_config_source.php(86): Smarty_Internal_Resource_File->getContent(Object(Smarty_Config_Source)) #1 C:\wamp\www\smarty\libs\sysplugins\smarty_internal_config_file_compiler.php(81): Smarty_Config_Source->__get('content') #2 C:\wamp\www\smarty\libs\sysplugins\smarty_internal_config.php(189): Smarty_Internal_Config_File_Compiler->compileSource(Object(Smarty_Internal_Config)) #3 C:\wamp\www\smarty\libs\sysplugins\smarty_internal_config.php(214): Smarty_Internal_Config->compileConfigSource() #4 C:\wamp\www\smarty\templates_c\187938f6ec55068ed23f0f2de8d126b1ae3149c7.file.temp.tpl.php(36): Smarty_Internal_Config->loadConfigVars(NULL, 'local') #5 C:\wamp\www\smarty\libs\sysplugins\smarty_internal_templatebase.php(180): content_4fb7f6591b8ab2_26457252(Object(Smarty_Internal_Template)) #6 C:\w in C:\wamp\www\smarty\libs\sysplugins\smarty_internal_resource_file.php on line 68
自定義函數<?phprequire_once './libs/Smarty.class.php';$smarty=new Smarty;function myfun($args){$str="";for($i=0;$i<$args['times'];$i++){$str.="測試";}return $str;}$smarty->register_function("doloop","myfun");$smarty->display("temp.tpl");?>
temp.tpl:{doloop times="5"}
報錯Fatal error: Uncaught exception 'SmartyException' with message 'Call of unknown method 'register_function'.' in C:\wamp\www\smarty\libs\sysplugins\smarty_internal_templatebase.php:806 Stack trace: #0 [internal function]: Smarty_Internal_TemplateBase->__call('register_functi...', Array) #1 C:\wamp\www\smarty\smarty.php(62): Smarty->register_function('doloop', 'myfun') #2 {main} thrown in C:\wamp\www\smarty\libs\sysplugins\smarty_internal_templatebase.php on line 806
我從smarty官方網站上下載了Smarty 3.1.8 [Smarty-stable.zip] Feb 20th, 2012文件啊stable這個單詞是穩(wěn)定的意思 我就下了這個包 解壓后 我把里面的libs文件夾拷貝到我的www/smarty目錄下,其它像在temp.tpl模板里運行{$smarty.server.SERVER_ADDR}這個語句可以正常顯示啊,為什么就運行上面的config_load和自定義函數就不行啊
總結
以上是生活随笔為你收集整理的require smarty.class.php 报错,Smarty 报错的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 天网防火墙技术白皮书
- 下一篇: lisp成套电气设计_关于成套设计转电气