<link rel="stylesheet" href="{{ URL::asset('css/bootstrap.css') }}">
<script type="text/javascript" src="{{ URL::asset('js/jquery.min.js') }}"></script>




第二种写法:laravel 默认是从public开始


<link rel="stylesheet" href=""/>







文件目录默认是在   public/ 自行放置即可






已标记关键词 清除标记
<div class="post-text" itemprop="text"> <p>I understand this sort of breaks the structured point of Laravel, but there is method to my madness. I plan on using a single install of laravel to host several websites that are database driven. At the moment all of the sites share the same layout and I have a system to store some custom CSS in the DB to give each site a different color scheme. I want to change this so they can use completely different views. So site A loads views/theme1/app.blade.php and site B loads views/theme2/app.blade.php. </p> <p>I have implemented this by using the following to return a view.</p> <pre><code>$theme = getDomainThemeName(); return view($theme.'/home'); </code></pre> <p>This is also working, but i am now left with the task of dynamically loading the assets. I am using bootstrap the generate the themes and making a few tweaks to the HTML to create the app.blade.php file. I have 2 potential solutions to this but i would much rather a way to server the css files from the views directory. This means the following mapping.</p> <blockquote> <p><a href="" rel="nofollow"></a> => /resources/views/theme1/css/style.css</p> </blockquote> <p>Can something like this be done? Another option would be to use php to read the css file and insert it into the app using a yield. It works, but it means i cant use browser caching to cache the assets. I was also thinking i could just create sub directories in the public folder. public/theme1/css/style.css. This makes the most logical sense, but it means i have to fragment the theme system. Id like to be able to unzip a theme in the views directory and it just works.</p> <p>I am using Laravel 5, i have root access to the server too. Running PHP 5.4 on centos 7.</p> </div>
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页