所以我的應用程序使用了大量的js文件。那很多的http請求。我決定將它們動態地在服務器上以功能組合的3-4個文件組合起來。會動態創建JavaScript文件嗎?
我的客戶端的請求是: ...腳本類型= 「文/ JavaScript的」 SRC = 「http://mydomain.com/core-js.php」 ......
我服務器端: --core-js.php-- header(「Content-type:application/x-javascript」);
include_once( 'file1.js'); include_once('file2.js'); include_once('file2.js'); include_once('file3.js'); include_once('file3.js'); include_once('file4.js'); include_once('file4.js');
我在core-js.php上設置了一個很遠的未來過期頭文件。我的問題是,是否將core-js.php緩存在客戶端?如果是的話,有人可以解釋一下嗎?
謝謝!
你想讓它們緩存嗎?請問core.js.php總是返回相同的javascript,還是根據頁面的需要動態組裝? – Rob 2010-03-31 15:24:21
我想讓他們緩存。它每次都是相同的文件集合。 – venksster 2010-04-05 15:30:33