Laravel routing settings and sub-router configuration instance analysis, laravel instance analysis. Laravel route settings and vro settings are analyzed by using the laravel instance. This article describes the Laravel route settings and vro settings. For your reference, the details are as follows: Laravel routing settings and vro settings instance analysis and laravel instance analysis.
This example describes how to set Laravel routing and vro. We will share this with you for your reference. The details are as follows:
Common route settings
1. routing (routes. php) Code:
Route::get('min','MinController@index');
Min: Route name, that is, the name entered in the url. for example, 127.0.0.1/min. here, min is the corresponding min.
MinController is the file name (class name)
@ Index indicates the method name.
2. Controller
namespace App\Http\Controllers;use App\Http\Controllers\Controller;class MinController extends Controller{ public function index(){ $name = 'Specs1'; return view('index')->with('name',$name); }}
Vro
1. routing:
Route: group (['namespace' => 'min'], function () {Route: get ('min/{index} ', 'mincontroller @ index '); // The {index} here is similar to a regular expression, that is, the url can be randomly entered: 127.0.0.1/min/$ index is like a variable, and everything can be input. But @ index is the real method });
Controller:
Namespace App \ Http \ Controllers \ Min; // Min is the Controller's folder path, use App \ Http \ Controllers \ Controller; class MinController extends Controller {public function index () {$ name = 'specs1'; return view ('min. index')-> with ('name', $ name); // min here. index is equivalent to min/index, which is the index under the min view folder. blade. php file }}
Structure: