我有一个zend框架应用程序正在运行。我已经创建了一个布局。现在我需要将引导css文件包含到我的布局中。
我尝试使用"baseUrl",但没有成功。我在"public/assets/css"中有css文件。
我还在zend框架网站上试用了教程。但它没有起作用。
他们提到要使用
<?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.html。
在布局中,我有以下代码
<!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未加载。谢谢
此处解释更改Mime类型
-
转到工具->选项
-
然后在
Miscellaneous
选项卡下选择文件类型css
,并确保Associated File Type
是text/css
编辑
尝试打开http://localhost:8010/assets/css/或http://localhost:8010/assets/你看到了什么?