【问题标题】:How to load all css and js at a time in Cakephp如何在 Cakephp 中一次加载所有 css 和 js
【发布时间】:2013-01-02 23:34:07
【问题描述】:

如何在一个请求中加载所有 css 和 js

这是一个示例 HTML 文档,同样包含许多 CSS 和 JavaScript 文件

... 更多

它发出 6 个请求,但我想一次加载所有 js 和 css(只有一个请求)

所以我试试

对于CSS

allStyles.css.php //

include("cssReset.css");

include("960framework.css");

include("base.css");

对于 js

allScripts.js.php

include("jQuery.js");

include("functions.js");

包括(“handlers.js”);

include("ajax.js");

include("navigations.css");

然后打电话

所有 js 和 css 都已加载,但 css 和 js 没有打开页面?

【问题讨论】:

    标签: javascript css cakephp cakephp-2.0


    【解决方案1】:

    php 未在响应中发送适当的内容类型标头。为您将这些行添加到页面顶部

    <?php header("Content-type: text/css"); ?>
    <?php header("Content-type: application/javascript"); ?>
    

    【讨论】:

      猜你喜欢
      • 2017-11-13
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 1970-01-01
      • 2014-09-05
      • 1970-01-01
      • 2013-07-27
      • 1970-01-01
      相关资源
      最近更新 更多