0
这里是我使用的控制器编码:缓存响应
- 发送用户到主视图
- 产生含有最终的响应代码(缓存)的HTML文件
这将是有关缓存的正确方法?我不确定倒带功能是否适用。请赐教:
public function index(Request $request, Response $response)
{
$view = '/src/views/home.php';
$this->render($response, Settings::ABSPATH . $view);
$body = $response->getBody();
$body->rewind();
$html = $body->getContents();
file_put_contents(Settings::ABSPATH . '/tmp/cachePages/home.html', $html);
return;
}
这是Slim3的权利? – jmattheis
是的,这是苗条的3 –