简体   繁体   中英

why laravel view is showing blank page?

when I open " http://localhost/app/public/ " the default laravel home page works perfectly which is a welcome page where in the routes file there is this:

Route::get('/', function () {
return view('welcome');
 });

but I'm learning so I just changed the "welcome" to "home" and created a new file resources/views/home.blade.php with the following simple code:

<?php
 echo 'hello world of laravel';
 ?>

but when I open " http://localhost/app/public/ "

it shows a blank page.

what am i missing?

您应该设置您的网络服务器,使其指向public目录,然后通过http://localhost/访问该应用程序

Try to change your home.blade.php to just html, remove this

 <?php
 echo 'hello world of laravel';
 ?>

and try something like:

<h1> Hello, world! </h1>

and see if works :)

这是打开 .env 文件确保您的应用程序名称中没有空格的解决方案。应用程序名称应该是一个单词,例如 AppOne 而不是 App One

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM