当使用Smarty时,似乎没有什么好的方法来实现显示程序执行时间。 WP或者其它程序时都有一个输出程序执行时间的功能,因此,在自己写的程序里,也想实现这一功能。 搜索了一下,发现基本没有这方面的文章。大多数人认为这个没有必要。 本着折腾的精神,开始一行行看Smarty的源码,最终找到一个比较精确计算出程序执行时间的方法。 在程序最开始部分,也就是执行的第一行代码的位置,加上: 1define(’__START_TIME’, microtime(TRUE)...
smarty局部缓存技术
其实我以前只是听过smarty的大名,并没有使用之。 最近做一个叫BlogShow的程序,想到用smarty来实现代码与表现的分离。于是慢慢边学边用,对它有了一定的了解。 发现smrty 是如此强大与神奇的一个东东,使我对它的好感不亚于对TP. 由于我默认是开启smarty的缓存的,但是在些地方的数据是实时更新或者更新较快的,不宜缓存,这样,局部缓存便有用武之地了。 1,insert 法 定义一个函数显示时间的: 12345function insert_get_current_time(&...
Parameter 3 to smarty_block_mynocache() expected to be a reference
php5.3 下,smarty 3.0b5部分缓存出错,提示错误信息为: Warning: Parameter 3 to smarty_block_mynocache() expected to be a reference, value given in D:\htdocs\project\***\libs\sysplugins\smarty_internal_plugin_handler.php on line 28 定义的部分缓存函数为: 1234function smarty_block_m...
Call to undefined method Smarty_Internal_Resource_File::getTemplateTimestampTypeName
今天把win下的程序移动到linux下,smarty 报错: Fatal error: Call to undefined method Smarty_Internal_Resource_File::getTemplateTimestampTypeName() in …/lib/Smarty3/sysplugins/smarty_internal_compile_include.php on line 54 简单地删除compile_c和cache目录下的缓存文件,问题解决。
...



近期评论