2016-06-07 43 views
0

當我嘗試打開資產時,我在頁面上添加了源(css,js),我在頁面末尾發現了日誌錯誤。Laravel 5.2資產實施

這裏是我試過到目前爲止:

homepage.blade.php

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

Composer.json

"require": { 
     "php": ">=5.5.9", 
     "laravel/framework": "5.2.*", 
     "laravelcollective/html": "^5.2" 
    } 

作曲家更新從控制檯。

加入app.php->提供商

Collective\Html\HtmlServiceProvider::class 

加入app.php->別名

'Form' => Collective\Html\FormFacade::class, 
'Html' => Collective\Html\HtmlFacade::class 

我laravel.log得到這樣的:

local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Illuminate\Html\HtmlServiceProvider' not found' in /var/www/html/myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:146 

提前致謝。

+0

我不知道這是否會做到這一點,但我通常只使用兩個'{{'。所以它會是'{{asset()}}'。但我不認爲這是你的問題,請仔細檢查文件是否確實存在於供應商文件夾中。 –

+0

嘗試集體\ HTML \ HtmlServiceProvider ::類 –

+0

@DevinGray不會改變任何東西。 –

回答

0

謝謝您的回答。

問題是關於設置虛擬主機設置錯誤。所以我無法達到真正的道路。

我重新設置了虛擬主機配置,現在它可以正常工作。

<VirtualHost *:80> 
     ServerName mysite.com 
     ServerAdmin [email protected] 
     DocumentRoot /var/www/html/mysite/public 

     <Directory /> 
       Options FollowSymLinks 
       AllowOverride None 
     </Directory> 
     <Directory "/var/www/html/mysite"> 
       AllowOverride All 
     </Directory> 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

參考:http://vaguelyuseful.info/2016/02/02/installing-laravel-5-2-on-ubuntu-15-10-and-apache2/

再次謝謝大家。

1

改變這一點:

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

到這一點:

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