未找到类'App \ Http \ Controllers \ View'

时间:2017-11-19 16:41:18

标签: php mysql laravel-5 namespaces artisan

我是Laravel的新人。我的观点不适用于控制器原因。 我的看法 : `

<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>

`

我的控制器是:

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
    }
}

1 个答案:

答案 0 :(得分:2)

你应该添加:

use View;

后行:

use Illuminate\Http\Request;

没有它,您尝试使用当前命名空间中的View,这是App\Http\Controllers