Home >Web Front-end >HTML Tutorial >YII page cache_html/css_WEB-ITnose
【Page Caching】
1. Is it possible to achieve it through "Fragment Caching"?
Answer: This is not possible because the layout file has not been cached yet
2. Can we re-layout for page caching?
A: Theoretically not, the view is loaded first, and the layout is loaded later. This can be proven by the timestamp
User access control implements page caching
Filters
accessControl
accessRules
<?php/** * 商品控制器 */class GoodsController extends Controller { /* * 通过用户访问控制过滤实现页面缓存 * 过滤器: * accessControl 是方法过滤器 * array() 是类过滤器 */ function filters(){ return array( //'accessControl', 方法过滤器 //类过滤器 实现页面整体缓存 COutputCache.php //只针对detail进行页面缓存 array( 'system.web.widgets.COutputCache + detail', 'duration'=>1800, 'varyByParam'=>array('id'), ), ); }