페이지를로드하려고 할 때 ReflectionException 클래스가 존재하지 않는다는 오류가 발생합니다 (열기 : /var/www/laravel_guestbook/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php). 이 오류의 원인에 대한 통찰력.
또한 내 프로젝트 폴더의 루트에서 'composer dump-autoload'를 실행하여 아무 소용이 없습니다.
route.php
Route::controller('EntriesController', '/');
Entry.php
<?php
class Entry extends Eloquent {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'entries';
}
?>
home.blade.php
<html>
<head>
<title>Laravel 4 Guestbook</title>
</head>
<body>
@foreach ($entries as $entry)
<p>{{ $entry->comment }}</p>
<p>Posted on {{ $entry->created_at->format('M jS, Y') }} by
<a href="mailto:{{ $entry->email }}"> {{ $entry->username}}</a>
</p><hr>
@endforeach
<form action="/" method="post">
<table border="0">
<tr>
<td>Name</td>
<td><input type="text" name="frmName" value="" size="30" maxlength="50"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="frmEmail" value="" size="30" maxlength="100"></td>
</tr>
<tr>
<td>Comment</td>
<td><input textarea name="frmComment" row="5" cols="30"></textarea></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit" value="submit">
<input type="reset" name="reset" value="reset">
</td>
</tr>
</table>
</form>
</body>
EntryController.php
<?php
class EntriesController extends BaseController {
# Handles "GET /" request
public function getIndex()
{
return View::make('home')
->with('entries', Entry::all());
}
# Handles "POST /" request
public function postIndex()
{
// get form input data
$entry = array(
'username' => Input::get('frmName'),
'email' => Input::get('frmEmail'),
'comment' => Input::get('frmComment'),
);
// save the guestbook entry to the database
Entry::create($entry);
return Redirect::to('/');
}
}
?>
다음과 같이 가정합니다.
Route::controller('/', 'EntriesController');
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다