简体   繁体   English

Symfony \\组件\\ HttpKernel \\异常\\ NotFoundHttpException

[英]Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

I am an obvious beginner of laravel and I am having a problem about this : Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException 我显然是laravel的初学者,对此有一个问题:Symfony \\组件\\ HttpKernel \\ Exception \\ NotFoundHttpException

I don't know on what seems to be the problem.. Whenever I hit the register button, That error would show up. 我不知道这是什么问题。每当我按下注册按钮时,就会出现该错误。 What would be the probable cause for this error? 此错误的可能原因是什么?

AdminController.php: AdminController.php:

<?php

class AdminController extends Basecontroller{

    public function index()
    {   
        return View::make('content.index');
    } 

    public function registration()
    {
        return View::make('content.registration');
    }

    public function registrationSave()
    {
        $input= Input::all();
        $rules = array('username'=>'required|unique:admin', 'name'=>'required|unique:admin', 'password'=>'required');
        $validate = Validator::make($input,$rules);
        if($validate->passes())
        {
            $password = $input['password'];
            $password = Hash::make($password);

            $user= new User();
            $user->username=$input['username'];
            $user->name=$input['name'];
            $user->password=$password;
            $user->save();

            return Redirect::to('registration');

        }
    }

}

routes.php: routes.php文件:

    Route::get('/','AdminController@index');

// Admin Registration
Route::get('admin/registration','AdminController@registration');
Route::post('admin/registration','AdminController@registrationSave');

registration.blade.php: registration.blade.php:

   @extends('layouts.master')
   @section('content')
     {{ Form::open(['url'=>'admin/registrationSave']) }}
          <div>
          {{ Form::label('name','Name: ') }} 
          {{ Form::text('name','',['placeholder'=>'Name']) }}          
          </div>
          <div>      
          {{ Form::label('username','Username: ') }} 
          {{ Form::text('username','',['placeholder'=>'Username']) }}
          </div>
          <div>
          {{ Form::label('password','Password: ') }} 
          {{ Form::password('password','',['placeholder'=>'Password']) }}          
          </div>

          <div>
          {{ Form::submit('Register') }}
          </div>
       {{ Form::close() }}
@endsection  
{{ Form::open(['url'=>'admin/registrationSave']) }}

It looks like you're trying to point the URL to the method name of the controller, rather than the URL of the route itself. 似乎您正在尝试将URL指向控制器的方法名称,而不是路由本身的URL。 The get/post routes share the same actual URL, so change that line to this: get / post路由共享相同的实际URL,因此将该行更改为此:

{{ Form::open(['url'=>'/admin/registration']) }}

暂无
暂无

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

相关问题 Symfony\Component\HttpKernel\Exception\NotFoundHttpException - Symfony\Component\HttpKernel\Exception\NotFoundHttpException 异常:“Symfony\Component\HttpKernel\Exception\NotFoundHttpException”,...} - exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…} "{消息:“”,异常:“Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException”,...}" - {message: "", exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…} 异常:“Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException”,... - exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",… Laravel 4错误Symfony \\组件\\ HttpKernel \\异常\\ NotFoundHttpException - Laravel 4 Error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException Laravel错误Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException - Laravel error Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException Laravel中的Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException错误 - Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException Error in Laravel Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException Laravel - Symfony\Component\HttpKernel\Exception\NotFoundHttpException Laravel Symfony \\组件\\ HttpKernel \\异常\\ NotFoundHttpException Laravel 4.1 - Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException Laravel 4.1 Laravel 错误 8 Symfony\Component\HttpKernel\Exception\NotFoundHttpException - Laravel error 8 Symfony\Component\HttpKernel\Exception\NotFoundHttpException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM