dppxp79175
2019-01-09 07:36
浏览 163
已采纳

视图不显示在laravel中

I have install laravel in my local server. I have route with following code

Route::get ( '/', function () {
return view ( 'welcome' );
});
Route::get('/home', 'HomeController@index');

And controller file with following code

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    echo 'test';
}

/**
 * Show the application dashboard.
 *
 * @return \Illuminate\Http\Response
 */
public function index()
{
    echo 'test1';exit;
    return view('welcome');
}
}

But i am not able to access my view file name welcome.blade.php in resources/views directory. i have try following urls in web browser but i got blank page every time.

URL 1: http://localhost/StripeIntegration_laravel-master/public/home

URL 2: http://localhost/StripeIntegration_laravel-master/public/index.php/home

URL 3: http://localhost/StripeIntegration_laravel-master/public/

Please help me to solve out this.

图片转代码服务由CSDN问答提供 功能建议

我在本地服务器上安装了laravel。 我有以下代码的路由</ p>

  Route :: get('/',function(){
return view('welcome'); 
}); 
Route:  :get('/ home','HomeController @ index'); 
 </ code> </ pre> 
 
 

控制器文件包含以下代码</ p>

 <  code> namespace App \ Http \ Controllers; 
 
use Illuminate \ Http \ Request; 
 
class HomeController扩展Controller 
 {
 / ** 
 *创建一个新的控制器实例。
 * 
 * @  return void 
 * / 
public function __construct()
 {
 echo'test'; 
} 
 
 / ** 
 *显示应用程序仪表板。
 * 
 * @return \ Illuminate  \ Http \ Response 
 * / 
公共函数索引()
 {
 echo'test1';退出; 
返回视图('welcome'); 
} 
} 
 </ code> </  pre> 
 
 

但是我无法在资源/视图目录中访问我的视图文件名 welcome.blade.php </ strong>。 i已尝试在网络浏览器中关注网址但我得到了 每次都是空白页。</ p>

网址1: http:/ /本地主机/ STR ipeIntegration_laravel-master / public / home </ p>

URL 2: http://localhost/StripeIntegration_laravel-master/public/index.php/home </ p>

网址3: http:// localhost / StripeIntegration_laravel-master / public / </ p>

请帮帮我 解决这个问题。</ p> </ div>

4条回答 默认 最新

相关推荐 更多相似问题