+ baseControl: use client cache before render html.

This commit is contained in:
liugang
2024-05-17 11:15:01 +08:00
parent 2f434f9fc3
commit e26b5c1d3e
+20
View File
@@ -735,6 +735,9 @@ class baseControl
ob_start();
include $viewFile;
if(isset($hookFiles)) foreach($hookFiles as $hookFile) if(file_exists($hookFile)) include $hookFile;
$this->useClientCache();
$this->output .= ob_get_contents();
ob_end_clean();
@@ -1033,6 +1036,8 @@ class baseControl
ob_start();
include $viewFile;
$this->useClientCache();
if(!$context->rendered) \zin\renderPage();
$content = ob_get_clean();
@@ -1046,6 +1051,21 @@ class baseControl
chdir($currentPWD);
}
/**
* 使用客户端缓存。
* Use client cache.
*
* @access public
* @return void
*/
public function useClientCache()
{
if(!$this->config->cache->client->enable || !$this->app->useClientCache) return;
helper::setStatus(304);
helper::end();
}
/**
* 直接输出data数据,通常用于ajax请求中。
* Send data directly, for ajax requests.