当我点击一个链接,我得到的数据,但我的css页面,Js文件和图像不工作。下面我提到链接、路由、控制器和错误(Firebug控制台)。请帮我清除这个错误。
从页面链接
<a href="customersocialpage/<?php echo $searchCustomer->customer_id; ?>"><?php echo ucfirst($searchCustomer->firstname); ?></span> <?php echo ucfirst($searchCustomer->lastname); ?></h5></a>routes.php
$router->get('customersocialpage/{id}', ['as' => 'custsocialpage', 'uses' => 'CustomersocialpageController@index']);CustomersocialpageController.php
public function index($id)
{
dd($id);
$customersocialpages = Customeraddress::where('customer_id', $id)->first();
return view('pages.customersocialpage',['customersocialpages' => $customersocialpages]);
}错误
"NetworkError: 404 Not Found - http://baselaravel.dev/customersocialpage/assets/img/demo/calendar_app.svg"链接到CSS
{!!HTML::style('assets/plugins/pace/pace-theme-flash.css')!!}
{!!HTML::style('assets/plugins/boostrapv3/css/bootstrap.min.css')!!}
{!!HTML::style('assets/plugins/font-awesome/css/font-awesome.css')!!}链接到JS
{!!HTML::script('assets/plugins/imagesloaded/imagesloaded.pkgd.min.js')!!}
{!!HTML::script('assets/plugins/jquery-isotope/isotope.pkgd.min.js')!!}
{!!HTML::script('assets/plugins/classie/classie.js')!!}
{!!HTML::script('assets/plugins/codrops-stepsform/js/stepsForm.js')!!}所有的css、图像和js都在公用文件夹中。
发布于 2015-08-13 12:17:22
好,在与OP对话时,在包含资产文件时出现了一些错误。因此,应以下列方式将其包括在内:
<link type="text/css" href="{{URL::to('assets/plugins/pace/pace-theme-flash.css')}}"></link>
<link type="text/css" href="/assets/plugins/pace/pace-theme-flash.css"></link> \图片
<img alt="Cover photo" src="{{URL::to('assets/img/social/cover.png')}}" />
<img alt="Cover photo" src="/assets/img/social/cover.png" />包含文件的方法有很多种,只需依赖于您所遵循的。包含资产的看看这个链接。休息的拉拉医生总是在那里。:)
谢谢
发布于 2015-08-13 11:38:48
看起来您使用了与资产的相对链接(如<a href="somelink"><img src="assets/img/demo/calendar_app.svg">Link</a>),而绝对链接则意味着要使用:
<a href="somelink"><img src="/assets/img/demo/calendar_app.svg">Link</a>
或者,用更多的拉勒维尔的方式:
<a href="{{ route('customersocialpage.index', $searchCustomer->customer_id) }}"><img src="{{ asset('assets/img/demo/calendar_app.svg') }}">Link</a>
Upd.
将您的{!!HTML::style('assets/plugins/pace/pace-theme-flash.css')!!}链接修复到绝对链接,或者使用SerafimArts/资产包,它将允许您链接页面上的资产,如下所示:
{!! asset_link('less/style.less') !!}
{!! asset_link('js/jquery.js') !!}...and甚至允许您自动编译较少的样式表,并将负责缓存。
https://stackoverflow.com/questions/31986272
复制相似问题