简体   繁体   English

找不到类“ App \\ Http \\ Controllers \\ View”

[英]Class 'App\Http\Controllers\View' not found

I am new in Laravel. 我是Laravel新手。 My view is not for the controller why it is . 我的观点不是出于控制器的原因。 my view : ` 我的看法:

<div class="imgcontainer">

    <img src="img/img_avatar2.png" alt="Avatar" class="avatar">

</div>

<div class="container">

    <label><b>Username</b></label>

    <input type="text" placeholder="Enter Username" name="uname" required>

    <label><b>Password</b></label>

    <input type="password" placeholder="Enter Password" name="psw" required>

    <button type="submit">Login</button>

    <input type="checkbox" checked="checked"> Remember me

</div>

<div class="container" style="background-color:#f1f1f1">

    <span class="psw">Forgot <a href="#">password?</a></span>

    <span class="signup">New user <a href="signup">Sign Up?</a></span>

</div>

<div>

    <button type="button" class="cancelbtn">Cancel</button>

</div>

` `

my controller is: 我的控制器是:

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public $restful = true;

    public function showLogin()
    {
        // show the form
        return View::make('HomeController.login');
    }

    public function doLogin()
    {
        // process the form
    }
}

You should add: 您应该添加:

use View;

after line: 下一行:

use Illuminate\Http\Request;

without it, you are trying to use View from current namespace and this is App\\Http\\Controllers 没有它,您尝试使用当前名称空间中的View ,这是App\\Http\\Controllers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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