2011-01-22 83 views
2

我想給gzip ckeditor.js,我從爵士到PHP擴展改變,並添加此行ckeditor.js.php文件問題GZIP CKEditor的

<?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->基本路徑= '/ CKEditor的/';到$ CKEditor-> basePath ='/ckeditor/ckeditor.js.php';但它不起作用。

回答

1

如果你想壓縮靜態資源,最好通過apache mod_deflate來完成。 PHP速度很慢,不應該用於壓縮靜態資源,因爲無論文件被請求多少次,處理都會繼續進行。此外,mod_deflate將處理客戶端不支持gzip的情況。

此外,在您的示例中,您必須修改可能在原始代碼中的多個位置。這意味着比以後升級ckeditor更加困難。

+0

我在htaccess文件中的AddHandler有問題。 http://stackoverflow.com/questions/4747830/problem-with-addhandler-in-htaccess – imez 2011-01-22 09:00:12