我想学习laravel框架。我可以在我的get服务器(Wamp)中安装laravel,并获得一些学习它的教程,但是当我尝试将样式添加到这个path:("C:\wamp\www\laravel-master\app\views\hello.php") by asset()函数中的hello.php文件中的'h1‘标签时,出现了上面提到的错误。请帮我找出问题所在。以下是hello.php代码:
<style>
body {
margin:0;
font-family:'Lato', sans-serif;
text-align:center;
color: #999;
}
.welcome {
width: 300px;
height: 200px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -100px;
}
a, a:visited {
text-decoration:none;
}
h1 {
font-size: 32px;
margin: 16px 0 0 0;
}
</style>
</head>
<link rel="stylesheet" type="text/css" href="<?php echo asset('css/main.css'); ?>" >
<body>
<div class="welcome">
<a href="http://laravel.com" title="Laravel PHP Framework"> <img src="some_long_src" alt="Laravel PHP Framework"></a>
<h1 class="highlight">You have arrived.</h1>
</div>
</body>
</html>
和main.css:
.highlight {
border: solid 2px #F00;
}
我的laravel版本是4.2.16。
提前谢谢。
发布于 2016-07-01 11:34:21
我使用的是Laravel 5.2版
我使用这个没有问题:
<!-- JavaScripts -->
<script src="{{ asset('js/main.js') }}"></script>
发布于 2015-04-18 19:38:49
更改此部分:
<?php echo asset('css/main.css'); ?>
如下所示:
/css/main.css
发布于 2015-04-18 19:57:50
你可以试着像{{ HTML::style('css/main.css') }}
那样做
https://stackoverflow.com/questions/29716694
复制相似问题