是否可以在Laravel中使用大写字母和后来的小混合URL?

Here is an example (It's in Laravel 4).. I want my url like this http://example.com/home/SiteLocation and in routes.php I defined Route::get('home/SiteLocation','HomeController@Functionname');

My point is,

  1. Is it possible to use like this SiteLocation (lower case and upper case mix) as url ?

  2. If yes, how to define function in controller for the same ?

Is it possible to use like this SiteLocation (lower case and upper case mix) as url ?

Yes - it should just work, you shouldnt need to modify your code

If yes, how to define function in controller for the same ?

Your function name in your controller can be anything you like - it doesnt need to correspond to the url. For example this would work:

Route::get('home/SiteLocation','HomeController@siteLocation');

as would this:

Route::get('home/SiteLocation','HomeController@SiteLocation');

and this:

Route::get('home/SiteLocation','HomeController@other');

It’s always good practice to avoid using capital letters in your URLs.

Here’s why:

1-If your website is on a Windows server, then www.example.com/about will be handled exactly the same as www.example.com/About.
The Windows server is case insensitive. If your website is hosted on Linux, then those two addresses will be seen as two different pages(You can also provide a regex instead - but this might be a little OTT.).
2-Having Two URLs Lead to the Same Page is No Good for Search Rankings.

See define a case insensitive (part of a) route