mit lumen 5.2 mit der blade template engine?
Folge ich den offizielle Dokumentation von laravel Vorlagen erstellen, mit Klinge.Ich versuche, meine erste Vorlage aber nicht funktioniert.
1)Gespeichert resources/views/default.blade.php --->
<html>
<head>
@include('includes.head')
</head>
<body>
<div class="container">
@include('includes.header')
<div id="main" class="row">
@yield('content')
</div>
</div>
</body>
</html>
2)gespeichert resources/views/home.blade.php -->
@extends('layouts.default')
@section('content')
I am the Home Page!
@endsection
3)Gespeichert boostrap/app.php -->
$app->get('/', function (){
return view('home');
});
4) localhost:8000/return-Fehler -->
Hoppla, sieht aus wie etwas schief ging.
2/2 ErrorException in FileViewFinder.php Linie 137: Blick auf [layouts.default] nicht gefunden. (Sicht: /home/vagrant/lumen/resources/views/home.blade.php)
in FileViewFinder.php line 137
at CompilerEngine->handleViewException(object(InvalidArgumentException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('/home/vagrant/lumen/storage/framework/views/96985f6d91158d600b1d1b64b5a3060d84415fda.php', array('__env' => object(Factory), 'app' => object(Application))) in CompilerEngine.php line 59
at CompilerEngine->get('/home/vagrant/lumen/resources/views/home.blade.php', array('__env' => object(Factory), 'app' => object(Application))) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 199
at Response->__construct(object(View)) in RoutesRequests.php line 643
at Application->prepareResponse(object(View)) in RoutesRequests.php line 505
at Application->callActionOnArrayBasedRoute(array(true, array(object(Closure)), array())) in RoutesRequests.php line 479
at Application->handleFoundRoute(array(true, array(object(Closure)), array())) in RoutesRequests.php line 376
at Application->Laravel\Lumen\Concerns\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Laravel\Lumen\Routing\{closure}(object(Request)) in CorsMiddleware.php line 6
at CorsMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CorsMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Laravel\Lumen\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in RoutesRequests.php line 626
at Application->sendThroughPipeline(array('App\Http\Middleware\CorsMiddleware'), object(Closure)) in RoutesRequests.php line 382
at Application->dispatch(null) in RoutesRequests.php line 327
at Application->run() in index.php line 28
1/2 InvalidArgumentException in FileViewFinder.php Linie 137: Blick auf [layouts.default] nicht gefunden.
in FileViewFinder.php line 137
at FileViewFinder->findInPaths('layouts.default', array('/home/vagrant/lumen/resources/views')) in FileViewFinder.php line 79
at FileViewFinder->find('layouts.default') in Factory.php line 165
at Factory->make('layouts.default', array('obLevel' => '1', '__env' => object(Factory), 'app' => object(Application))) in 96985f6d91158d600b1d1b64b5a3060d84415fda.php line 4
at include('/home/vagrant/lumen/storage/framework/views/96985f6d91158d600b1d1b64b5a3060d84415fda.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('/home/vagrant/lumen/storage/framework/views/96985f6d91158d600b1d1b64b5a3060d84415fda.php', array('__env' => object(Factory), 'app' => object(Application))) in CompilerEngine.php line 59
at CompilerEngine->get('/home/vagrant/lumen/resources/views/home.blade.php', array('__env' => object(Factory), 'app' => object(Application))) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 199
at Response->__construct(object(View)) in RoutesRequests.php line 643
at Application->prepareResponse(object(View)) in RoutesRequests.php line 505
at Application->callActionOnArrayBasedRoute(array(true, array(object(Closure)), array())) in RoutesRequests.php line 479
at Application->handleFoundRoute(array(true, array(object(Closure)), array())) in RoutesRequests.php line 376
at Application->Laravel\Lumen\Concerns\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Laravel\Lumen\Routing\{closure}(object(Request)) in CorsMiddleware.php line 6
at CorsMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CorsMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Laravel\Lumen\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in RoutesRequests.php line 626
at Application->sendThroughPipeline(array('App\Http\Middleware\CorsMiddleware'), object(Closure)) in RoutesRequests.php line 382
at Application->dispatch(null) in RoutesRequests.php line 327
at Application->run() in index.php line 28
- warum verwenden von sichten mit lumen? es ist entworfen, für micro-apis! verwenden laravel statt
Du musst angemeldet sein, um einen Kommentar abzugeben.
Den URL, den Sie erwähnen ist für Laravel nicht Lumen, Lumen ist eine leichte, Laravel, Es ist für API-layer und backend-job-Verarbeitung. Ich empfehle Laravel statt.
Die ausgewählte Antwort (https://stackoverflow.com/a/37625344/7506001) ist falsch.
@joeldg und @autista_z sind beide richtig.
Als von Lumen 5.4, Klinge Ansichten sind noch vorhanden und verwendbar, auch wenn Sie nicht mehr dokumentiert.
Vollständigen Beispiel:
Funktion @extends('name') finden Sie eine Datei "name.blade.php" oder "name.php im Verzeichnis" resources/views"
Wenn Sie @extends('layouts.default'), es bedeutet, Sie finden die Datei "default.blade.php" oder "default.php" im Verzeichnis "resources/views/layouts" (Unterordner layouts in Aussicht)
Aber Sie haben Ihr "deafault.blade.php" in "resources/views"
So sollte es von @extends('default')
Die ausgewählte Antwort falsch ist, Lumen hat die Klinge standardmäßig installiert.
Die Rückkehr, die Sie verwenden, wird nicht funktionieren.
Ihre route schauen muss wie
Hatte ich dasselbe problem. Es geschieht, weil der Ordner /var/www* ist geschützt.
Müssen Sie ändern CHMOD und CHOWN von /Ressource-Ordner, in Ihr lumen Projekt, rekursiv.
Probieren Sie es aus:
$ cd /your-lumen-path
$ sudo chmod 777 -R storage
$ sudo chown -R $USER:$USER storage