简体   繁体   English

Laravel-5.3使用没有工匠服务命令?

[英]Laravel-5.3 use without artisan serve command?

I have a problem about laravel run without use php artisan serve command. 关于laravel run我有一个问题,没有使用php artisan serve命令。 I'm working in xampp/htdocs/works folder. 我在xampp / htdocs / works文件夹中工作。 I created a blog under htdocs/works folder and if i use php artisan not problem but i want to use without php artisan like localhost:8080/works/blog/ working but not find css and js files. 我在htdocs / works文件夹下创建了一个博客,如果我使用php artisan没有问题,但我想使用没有php artisan像localhost:8080 / works / blog / working但没有找到css和js文件。

How can I solved it ? 我怎么解决呢?

The first place I would check is the resources/views/layouts/app.blade.php or any other views you are trying to access and make sure it use a relative path like: 我要检查的第一个地方是资源/ views / layouts / app.blade.php或您尝试访问的任何其他视图,并确保它使用相对路径,如:

<link href="/css/app.css" rel="stylesheet">

The root is /public for the path, so in this example, app.css should be in public/css/app.css 对于路径,root是/ public,因此在此示例中,app.css应该位于public / css / app.css中

Hope this help. 希望这有帮助。

you can use the helper asset 你可以使用帮助资产

<link href="{{asset('css/app.css')}}" rel="stylesheet">

here the official doc https://laravel.com/docs/5.4/helpers#method-asset 这里是官方文档https://laravel.com/docs/5.4/helpers#method-asset

The best soulution which works every time, is using Elixir 每次都有效的最好的洗液是使用Elixir

Read the documentation, you can insert your files like 阅读文档,您可以插入您的文件

<link rel="stylesheet" href="{{ elixir('css/all.css') }}">
<script src="{{ elixir('js/app.js') }}"></script>

I recomend starting with Webpack. 我建议从Webpack开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM