We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c437b4 commit 03af923Copy full SHA for 03af923
routes/web.php
@@ -14,3 +14,23 @@
14
Route::get('/', function () {
15
return "Hello, World!";
16
});
17
+
18
+Route::get('user/{id?}', function ($id = 1) {
19
+ return "用户ID: " . $id;
20
+})->name('user.profile');
21
22
+Route::get('page/{id}', function ($id) {
23
+ return '页面ID: ' . $id;
24
+})->where('id', '[0-9]+');
25
26
+Route::get('page/{name}', function ($name) {
27
+ return '页面名称: ' . $name;
28
+})->where('username', '[A-Za-z]+');
29
30
+Route::get('page/{id}/{slug}', function ($id, $slug) {
31
+ return $id . ':' . $slug;
32
+})->where(['id' => '[0-9]+', 'slug' => '[A-Za-z]+']);
33
34
+Route::get('test', function () {
35
+ return route('user.profile', [100]);
36
+});
0 commit comments