我尝试使用以下PHP脚本创建一个CSS文件:集成在OpenCart中以减少http请求。
... \目录\控制器\ COMMON \ css.php:
class ControllerCommonCss extends Controller {
public function index() {
$this->log->write('test');
$cssFiles = array(
"stylesheet.css",
);
$buffer = "";
foreach ($cssFiles as $cssFile) {
$buffer .= file_get_contents($cssFile);
...
}
}
}
header.tpl:
<link rel="stylesheet" href="catalog/controller/common/css.php" type="text/css" media="screen">
error.log中的输出“test”不起作用。并且样式表不会加载到标题中。谁能告诉我什么是错的?
问候
您可以使用像NitroPack Cache这样的扩展程序,以及其他一些东西:https://docs.isenselabs.com/nitropack/minification