GZIP CKEditor的问题

时间:2011-01-22 08:41:57

标签: javascript gzip ckeditor

我想gzip ckeditor.js我将js的扩展名更改为php并将此行添加到ckeditor.js.php文件中

<?php
ob_start ("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>

此代码适用于其他.js文件,但ckeditor.js.php页面出现此错误:

Error: CKEditor not found.This sample assumes that CKEditor (not included with CKFinder) is installed inthe "/ckeditor/" path. If you have it installed in a different place, just editthis file, changing the wrong paths in the <head> (line 5) and the "BasePath"value (line 32). 

我找到了ckeditor_php5.php并进行了更改 * $ CKEditor-&gt; basePath ='/ ckeditor /'; to $ CKEditor-&gt; basePath ='/ fixitor / fixitor.js.php';但它不起作用。

1 个答案:

答案 0 :(得分:1)

如果要压缩静态资源,最好通过apache mod_deflate来完成。 PHP很慢,不应该用于压缩静态资源,因为无论请求文件多少次,处理都会继续发生。此外,mod_deflate将处理客户端不支持gzip的情况。

此外,在您的示例中,您必须在原始代码中修改多个位置。这意味着比升级ckeditor更难以后。