将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

Routing doesn't work in laravel 4
在 laravel 4中,路由不工作

0 0

I had installed Laravel with the following command

composer create-project laravel/laravel --prefer-dist

And everything is fine when i open /root. i saw"You have arrived."page but i can't make any route.When i write the following simple route i saw the page not found error.


Route::get('hello', function() {
 return 'Hello World';
});



error :


Not Found
The requested URL/afifnet/public/hello was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80 please help me.


时间: 原作者:

0 0

A couple of things. when you create a route you need to make sure you have a view. you can create a view by going the views folder (make sure you have the extension .blade.php

Create a View in your views folder (and add some content), eg :

 
test.blade.php

 

Then in your routes.php file add this :


Route::get('/test', function() { 

return View::make('test'); 

});


Now goto public/test and you should see the content you added to test.blade.php file.

If you still cannot create a route it's another issue, however seeing as you can see the landing page"you have arrived"everything should be working.

...