【问题标题】:I can't connect to assets & link path我无法连接到资产和链接路径
【发布时间】:2015-04-23 18:42:32
【问题描述】:

我想链接路径资产和其他页面。请帮助我,我该怎么做???

问题!

现在,我可以连接到http://yoseigi.com/night/,但我无法连接里面的资产。

[骨架]/laravelfiles/app/view/index.blade.php

@extends('layouts.ace.login')

@section('pagecontent')
    @{{ app_path() = }} <?php echo $path = app_path(); ?>
@stop 

[skeleton]/laravelfiles/app/view/layouts/ace/login.blade.php(代码资产路径)

{{-- Bootstrap --}}
{{ HTML::style('assets/bootstrap/css/bootstrap.min.css') }}
{{ HTML::style('assets/bootstrap/css/bootstrap-theme.min.css') }}

样式表 --> "Index.php" ?????

"NetworkError: 404 Not Found - http://yoseigi.com/night/Index.php/assets/bootstrap/css/bootstrap.min.css"
"NetworkError: 404 Not Found - http://yoseigi.com/night/Index.php/assets/bootstrap/css/bootstrap-theme.min.css"

yoseigi.com/dashboard

"NetworkError: 404 Not Found - http://yoseigi.com/night/dashboard"

路线

[骨架]/laravelfiles/app/routes.php

Route::get('/', function() {
    return View::make('index');
});
Route::get('dashboard', function() {
    return View::make('dashboard');
});

目录

yoseigi.com
|--httpdocs
    |--night
        |--assets
            |--ace
               |--css
               |--js
            |--bootstrap
               |--css
               |--js
        |--laravelfiles
            |--app
               |--config
                    |--app.php
                    |--view.php
               |--views
                    |--layouts
                        |--login.blade.php
                    |--dashboard.blade.php
                    |--index.blade.php
               |--routes.php
            |--bootstrap
               |--autoload.php
               |--paths.php
               |--start.php
        |--packages
        |--.htaccess
        |--index.php

htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    #RewriteRule ^(.+)$ /index.php [L]
</IfModule>

配置

[骨架]/index.php

require __DIR__.'/laravelfiles/bootstrap/autoload.php';
$app = require_once __DIR__.'/laravelfiles/bootstrap/start.php';

[骨架]/laravelfiles/bootstrap/paths.php

'app' => __DIR__.'/../app',
'public' => __DIR__.'/../..',
'base' => __DIR__.'/..',
'storage' => __DIR__.'/../app/storage',

[骨架]/laravelfiles/app/config/view.php

'paths' => array(__DIR__.'/../views'),
'pagination' => 'pagination::slider-3',

【问题讨论】:

    标签: laravel laravel-4 laravel-routing laravel-5


    【解决方案1】:

    不要使用 HTML 外观,而是尝试使用asset() 帮助器。

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

    【讨论】:

      猜你喜欢
      • 2017-11-13
      • 1970-01-01
      • 2021-09-11
      • 2014-08-17
      • 2018-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-28
      相关资源
      最近更新 更多