使用刀片访问laravel中的公用文件夹 [英] accessing public folder in laravel using blade

查看:86
本文介绍了使用刀片访问laravel中的公用文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为homePage.blade.php的视图,这是我的母版页,它位于该文件的res/views/中.

I have a view called homePage.blade.php which is my master page which resides in res/views/ in that file I have this.

<link rel="stylesheet" href="css/coreStyleSheet.css">
<link rel="stylesheet" href="css/animate.css">
<script src="js/coreScripting.js"></script>
<script src="js/moments.js"></script>
<link rel="stylesheet" href="icons/fontAwesome/css/font-awesome.css"> </head>

一切都好吗?

现在,我创建一个名为AppCreate的文件夹,该文件夹的路径为res/views/AppCreate我现在在使用@extends('homePage')时在其中有一个名为something.blade.php的刀片文件,但无法访问css,js.

Now I create a folder called AppCreate who's path is res/views/AppCreate I have a blade file there called something.blade.php now when I use @extends('homePage') I am not able to access the css,js.

我的树看起来像这样.

-res 视图 homePage.blade.php -AppCreate -something.blade.php

-res -views homePage.blade.php -AppCreate -something.blade.php

我重定向something.blade.php tp public/admin/appcreate 我将homePage.blade.php重定向到public/dashBoard.

I redirect something.blade.php tp public/admin/appcreate I redirect homePage.blade.php to public/dashBoard.

我希望我已经解释清楚了.

I hope I have explained it well.

当我访问公共/admin/appcreate时,laravel无法找到CSS和js,因为它说了这一点.

when I access the public /admin/appcreate laravel is not able to find the css and the js because it says this.

    GET http://localhost/laravel/public/admin/css/coreStyleSheet.css 
appcreate:12 GET http://localhost/laravel/public/admin/js/moments.js 
appcreate:11 GET http://localhost/laravel/public/admin/js/coreScripting.js 
appcreate:13 GET http://localhost/laravel/public/admin/icons/fontAwesome/css/font-awesome.css 

推荐答案

尝试使用 Helper函数像这样:

Try using the Helper Functions like this:

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

<script src="{{ asset('js/coreScripting.js') }}"></script>

假设您在公共/资产

这篇关于使用刀片访问laravel中的公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆