[英]Blank Page in Google Chrome
Try to load my own created page with using Laravel + Blade, but then the browser only displays the output a sec then disappears.尝试使用 Laravel + Blade 加载我自己创建的页面,但是浏览器只显示输出一秒钟然后消失。 I have no idea what is going wrong, everything in my code doing fine and without errors... Any thoughts???
我不知道出了什么问题,我的代码中的一切都很好,没有错误......有什么想法吗???
I'm running this page using php -S 127.0.0.1:8000 -t public我正在使用php -S 127.0.0.1:8000 -t public运行此页面
This is web.php:这是 web.php:
Route::get('/products/create', 'ProductsController@create');
This is ProductsController.php:这是 ProductsController.php:
public function create(){
return view('products.create');
}
This is create.blade.php:这是 create.blade.php:
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add new product</h1>
<form action="/products" method="POST">
@csrf
<div class="container">
<div class="form-group row">
<label for="pName" class="col-md-4 col-form-label">Product name</label>
<input id="pName"
name="pName"
type="text"
class="form-control @error('pName') is-invalid @enderror"
value="{{ old('pName') }}"
autocomplete="pName"
autofocus>
</div>
<div class="form-group row">
<label for="pCat" class="col-md-4 col-form-label">Category</label>
<input id="pCat"
name="pCat"
type="text"
class="form-control @error('pCat') is-invalid @enderror"
value="{{ old('pCat') }}"
autocomplete="pCat"
autofocus>
</div>
</div>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
</div>
@endsection
Here's the webpack.mix.js:这是 webpack.mix.js:
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.mixbrowserSync('localhost:8000');
It seems like the @extends('layouts.app') is not working, because when I removed it, the page could run tho.似乎@extends('layouts.app') 不起作用,因为当我删除它时,页面可以运行。 Any solution to solve it or did missing some dependencies to install??
有什么解决方案可以解决它还是缺少一些要安装的依赖项?
Look in your Laravel log file normally located at /storage/logs/laravel.log
查看通常位于
/storage/logs/laravel.log
Laravel 日志文件
And you may want to serve it with artisan instead:你可能想用工匠来代替它:
php artisan serve
Local Development Server If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the serve Artisan command.
本地开发服务器 如果您在本地安装了 PHP,并且您想使用 PHP 的内置开发服务器来为您的应用程序提供服务,您可以使用 serve Artisan 命令。 This command will start a development server at http://localhost:8000 :
此命令将在http://localhost:8000启动开发服务器:
https://laravel.com/docs/master/logging https://laravel.com/docs/master/logging
https://laravel.com/docs/master/installation https://laravel.com/docs/master/installation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.