關於smarty的is_cached()方法的問題請大神幫忙.萬分感激.

來源:互聯網
上載者:User
Fatal error: Uncaught --> Smarty: Smarty->is_cached() undefined method <--thrown in /usr/local/apache2/htdocs/www/smarty/libs/sysplugins/smarty_internal_undefined.php on line 46


今天用了if(!is_cached("var.html",$_SERVER["REQUEST_URI"])){
echo "today is beautiful day!
";
}
來測試smarty是否緩衝,出現以上的錯誤,我的smarty的版本是:smarty-3.1.29.是不是我用的smarty版本沒有了這個方法?如果不用這個方法,那又是用什麼方法來代替?請大神幫忙解決.萬分感激....


回複討論(解決方案)

那您 print_r(get_class_methods('Smarty')); 看一下不就知道啦?

再說,你寫成 if(!is_cached("var.html",$_SERVER["REQUEST_URI"])){ 也是不對的吧?

二樓,用
echo '

';  
var_dump($smarty);
echo'
';  
得的結果是以下,
object(Smarty)#1 (65) {
["auto_literal"]=>
bool(true)
["error_unassigned"]=>
bool(false)
["use_include_path"]=>
bool(false)
["template_dir":"Smarty":private]=>
array(1) {
[0]=>
string(42) "/usr/local/apache2/htdocs/www/smarty/temp/"
}
["_joined_template_dir"]=>
string(42) "/usr/local/apache2/htdocs/www/smarty/temp/"
["_joined_config_dir"]=>
string(44) "/usr/local/apache2/htdocs/www/smarty/configs"
["default_template_handler_func"]=>
NULL
["default_config_handler_func"]=>
NULL
["default_plugin_handler_func"]=>
NULL
["compile_dir":"Smarty":private]=>
string(41) "/usr/local/apache2/htdocs/www/smarty/com/"
["plugins_dir":"Smarty":private]=>
NULL
["cache_dir":"Smarty":private]=>
string(43) "/usr/local/apache2/htdocs/www/smarty/cache/"
["config_dir":"Smarty":private]=>
array(1) {
[0]=>
string(44) "/usr/local/apache2/htdocs/www/smarty/configs"
}
["force_compile"]=>
bool(false)
["compile_check"]=>
bool(true)
["use_sub_dirs"]=>
bool(false)
["allow_ambiguous_resources"]=>
bool(false)
["merge_compiled_includes"]=>
bool(false)
["force_cache"]=>
bool(false)
["left_delimiter"]=>
string(2) "<{"
["right_delimiter"]=>
string(2) "}>"
["security_class"]=>
string(15) "Smarty_Security"
["security_policy"]=>
NULL
["php_handling"]=>
int(0)
["allow_php_templates"]=>
bool(false)
["debugging"]=>
bool(false)
["debugging_ctrl"]=>
string(4) "NONE"
["smarty_debug_id"]=>
string(12) "SMARTY_DEBUG"
["debug_tpl"]=>
NULL
["error_reporting"]=>
NULL
["config_overwrite"]=>
bool(true)
["config_booleanize"]=>
bool(true)
["config_read_hidden"]=>
bool(false)
["compile_locking"]=>
bool(true)
["cache_locking"]=>
bool(false)
["locking_timeout"]=>
int(10)
["default_resource_type"]=>
string(4) "file"
["caching_type"]=>
string(4) "file"
["default_config_type"]=>
string(4) "file"
["resource_cache_mode"]=>
int(1)
["cache_modified_check"]=>
bool(false)
["registered_plugins"]=>
array(0) {
}
["registered_objects"]=>
array(0) {
}
["registered_classes"]=>
array(0) {
}
["registered_filters"]=>
array(0) {
}
["registered_resources"]=>
array(0) {
}
["registered_cache_resources"]=>
array(0) {
}
["autoload_filters"]=>
array(0) {
}
["default_modifiers"]=>
array(0) {
}
["escape_html"]=>
bool(false)
["start_time"]=>
float(1461252359.6399)
["_current_file"]=>
NULL
["_parserdebug"]=>
bool(false)
["_objType"]=>
int(1)
["_debug"]=>
NULL
["cache_id"]=>
NULL
["compile_id"]=>
NULL
["caching"]=>
int(1)
["cache_lifetime"]=>
int(3600)
["_cache"]=>
array(6) {
["template_dir_new"]=>
bool(true)
["template_dir"]=>
bool(false)
["compile_dir"]=>
bool(true)
["config_dir_new"]=>
bool(true)
["config_dir"]=>
bool(false)
["cache_dir"]=>
bool(true)
}
["template_class"]=>
string(24) "Smarty_Internal_Template"
["tpl_vars"]=>
array(0) {
}
["parent"]=>
NULL
["config_vars"]=>
array(0) {
}
["ext"]=>
object(Smarty_Internal_Extension_Handler)#2 (3) {
["objType"]=>
int(1)
["_property_info":"Smarty_Internal_Extension_Handler":private]=>
array(7) {
["AutoloadFilters"]=>
int(0)
["DefaultModifiers"]=>
int(0)
["ConfigVars"]=>
int(0)
["DebugTemplate"]=>
int(0)
["RegisteredObject"]=>
int(0)
["StreamVariable"]=>
int(0)
["TemplateVars"]=>
int(0)
}
["resolvedProperties":"Smarty_Internal_Extension_Handler":private]=>
array(0) {
}
}
}
沒有is_cached()此方法,我問題要問的是,如果沒有is_cached()這個方法,哪用什麼方法來代替?不勝感謝...

謝謝二樓,已經搞掂。。。。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.