我有一个运行的zend框架应用程序。我已经创建了一个布局。现在,我需要在我的布局中包含bootstrap css文件。
我尝试了'baseUrl',但是没有用。我在“ public / assets / css”中有css文件。
我也在zend Framework网站上尝试了教程。但这没用。
他们提到要使用
<?php echo $this->headLink()->appendStylesheet('/assets/css/bootstrap.css') ?>
我在布局页面中添加了上述行,但是没有用。
在我使用此头链接时,供您参考,在控制台中显示为
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8010/assets/css/bootstrap.css".
任何帮助将不胜感激。预先感谢。
头部标签:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zend Framework Quickstart Application</title>
<link href="/assets/css/bootstrap.css" media="screen" rel="stylesheet" type="text/css">
</head>
其他信息:我有一个控制器'HomeController',它已经定义了一个动作
public function homeTwoAction()
{
// action body
$this->_helper->layout->setLayout('layout');
}
在视图中->我在'scripts / home'中有home-two.phtml。
在布局中,我有以下代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bootstrap</title>
<!-- <link rel="stylesheet" href="style/bootstrap.min.css">-->
<!-- <link rel="stylesheet" href="style/customstyle.css">-->
<!--<link type="text/css" rel="stylesheet" href="/assets/css/customstyle.css">-->
<?= $this->headLink()->appendStylesheet('/assets/css/customstyle.css') ?>
<?= $this->headLink()->appendStylesheet('/assets/css/bootstrap.min.css') ?>
</head>
<body>
<div class="container-fluid">
<?php echo $this->layout()->content ?>
</div>
</body>
</html>
我正在访问
http://localhost:8010/home/home-two
已加载HTML内容,但未加载CSS。谢谢。
答案 0 :(得分:0)
更改Mime类型的说明here
转到工具->选项
然后在Miscellaneous
标签下选择文件类型css
,并确保Associated File Type
为text/css
尝试打开http://localhost:8010/assets/css/或http://localhost:8010/assets/会看到什么?