Javascript GZIP编辑器的问题

Javascript GZIP编辑器的问题,javascript,gzip,ckeditor,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,

我想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。此示例假定CKEditor(不包括在CKFinder中)安装在“/CKEditor/”路径中。如果将其安装在其他位置,只需编辑此文件,更改(第5行)中的错误路径和“BasePath”值(第32行)。
我找到了ckeditor_php5.php和change
*$CKEditor->basePath='/CKEditor/';到$CKEditor->basePath='/CKEditor/CKEditor.js.php';但它不起作用

如果要压缩静态资源,最好通过apache进行压缩。PHP速度很慢,不应用于压缩静态资源,因为无论文件被请求多少次,处理都将持续进行。此外,mod_deflate将处理客户端不支持gzip的情况


此外,在您的示例中,您可能需要修改原始代码中的多个位置。这意味着以后升级ckeditor会更困难。

我在htaccess文件中遇到AddHandler问题。好的,但我的回答给出了你应该为你提出的特定问题做些什么。我在另一台主机上安装了ckeditor。我没有在这个网站上使用gzip和deflate。但我用YSlow检查了ckeditor.js文件,文件大小减少到110KB。主持人是怎么做到的?@imez:我不太明白你的意思。请解释。对不起,英语不好。我在另一台主机上有另一个站点。我没有在这个网站上使用deflate或gzip。那么为什么js文件的大小更小(我用YSLOW插件firefox检查)。是否托管gzip或解压缩js文件?