i have this code but my Method not find ?
Route.php
Route::controller('Basic', 'BasicController');
BasicController.php
class BasicController extends BaseController {
public function getIndex()
{
return View::make('hello');
}
public function getTest()
{
return 'test';
}
}
when i call test from browser : ` http://mydomain.dev/Basic/Test Not Work !
and get this error :
Symfony \\ Component \\ HttpKernel \\ Exception \\ NotFoundHttpException
Controller method [Test] not found.
open: /var/www/mydomain.dev/vendor/laravel/framework/src/Illuminate/Routing/Controller.php
* @param array $parameters
* @return mixed
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function missingMethod($method, $parameters = array())
{
throw new NotFoundHttpException("Controller method [{$method}] not found.");
}
Why ?
My laravel version is 4.1.8
If you execute
artisan routes
You probably will see those routes
+--------+--------------------------------------------------------+------------+--------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+--------------------------------------------------------+------------+--------------------------------+----------------+---------------+
| | GET Basic/index/{one?}/{two?}/{three?}/{four?}/{five?} | | BasicController@getIndex | | |
| | GET Basic | | BasicController@getIndex | | |
| | GET Basic/test/{one?}/{two?}/{three?}/{four?}/{five?} | | BasicController@getTest | | |
| | GET Basic/{_missing} | | BasicController@missingMethod | | |
| | GET test | | Closure | | |
If you say that your index is working:
So you need hit the route
http://mydomain.dev/Basic/test
and not
http://mydomain.dev/Basic/Test
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.