Laravel 3.2 Documentation........................................................................... 49 Working With The URI ................................................................................................. 49 When creating links just use the route's name and Laravel will automatically insert the correct URI. This allows you to change your routes at a later time and Laravel will update all of the relevant { // }); Registering a single URI for multiple HTTP verbs: Router::register(array('GET', 'POST'), $uri, $callback); 16 Wildcards Forcing a URI segment to be any digit: Route::get('user/(:num)'0 码力 | 139 页 | 1.13 MB | 1 年前3
《Slides Dev Web》02. Introduction aux frameworks PHP
et de l’Internet. Qu’est-ce qu’Internet16 ? • un réseau IP Qu’est-ce que le World Wide Web ? • URI/URL, des identifiants uniques • HTML, un langage de publication • HTTP, un protocole d’échange de texte e#PHP 17 URI as UI Pensez à Wikipedia. Les adresses des pages font partie de l’expérience utilisateur. Un utilisateur doit être capable d’imaginer le contenu de la page en lisant l’URI. Certainement e.html#try_files 18 // 04-routes/index.php $uri = $_SERVER['REQUEST_URI'], $matches = []; preg_match( "#^/(?P[^/]+)/(?P [^/]+)/?#", $uri, $matches ) or die('Arrrrrgh'); echo call_user_func_array( 0 码力 | 24 页 | 1.03 MB | 1 年前3
Laravel 5.0 Documentation
following directive in your site configuration will allow "pretty" URLs: location / { try_files $uri $uri/ /index.php?$query_string; } Of course, when using Homestead, pretty URLs will be configured automatically Response Template Maintenance Mode & Queues Pretty URLs Apache Nginx location / { try_files $uri $uri/ /index.php?$query_string; } Of course, when using Homestead, pretty URLs will be configured automatically by the App\Providers\RouteServiceProvider class. The most basic Laravel routes simply accept a URI and a Closure : Route::get('/', function() { return 'Hello World'; }); Route::post('foo/bar'0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 5.6 中文文档RewriteRule ^ index.php [L] Nginx 如果你使用的是 Nginx,使用如下站点配置指令就可以支持 URL 美化: location / { try_files $uri $uri/ /index.php?$query_string; } 当然,使用 Homestead 或 Valet 的话,以上配置已经为你配置好,无需额外操作。 环境配置 基于应用运行的 和 frontControllerPath。 这三个方法接收 $sitePath、$siteName 和 $uri 值作为参数,其中 $sitePath 表示站点目录,如 ~/Sites/my-project,$siteName 表示主域名 部分,如 my-project,而 $uri 则是输入的请求地址,如 /foo/bar。 编写好自定义的 Valet 驱动后,将其放到 ~/.valet/Drivers @param string $siteName * @param string $uri * @return void * @translator laravelacademy.org */ public function serves($sitePath, $siteName, $uri) { return is_dir($sitePath.'/wp-admin');0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 5.3 中文文档Laravel 学院致力于提供优质 Laravel 中文学习资源 16 应用让用户从应用中退出。想要升级的话,需要将原来的退出请求转化为 POST 请求方式,或者 为/logout URI 自定义 GET 路由: Route::get('/logout', 'Auth\LoginController@logout'); 授权 使用类名调用策略方法 有时候一些策略 Route::resource('photos', 'PhotoController'); show 路由的 URI 将会定义如下: /photos/{photos} 在 Laravel 5.3 中,所有资源路由参数默认都是单数化的,因此,同样调用 Route::resource,将 会注册 URI 如下: /photos/{photo} 如 果 你 想 要 继 续 维 护 之 前 Laravel 中文学习资源 30 使用 Route::resource 的时候 URI 前缀将不再影响分配给路由的路由名称,如果在 Route::group 中使用 Route::resource 时调用了指定的 prefix 选项,则需要检查所有对 route 辅助函数的调 用以验证不再追加 URI 的 prefix 到路由名称。 如果这一改动导致同一名称下有两个路由,可以在调用 Route::resource0 码力 | 691 页 | 9.37 MB | 1 年前3
Laravel 6.0 中文文档com 24 在之前版本的 Laravel 中,传递关联数组参数到 route 辅助函数或 者 URL::route 方法生成指定路由(包含可选参数)对应 URL 时偶 尔会出现将这些参数作为 URI 值的现象,即使传递参数值在路由路 径中没有匹配键。从 Laravel 6.0 开始,这些值会被追加到查询字符 串中,如下所示: Route::get('/profile/{location?}' RewriteRule ^ index.php [L] Nginx 如果你使用的是 Nginx,使用如下站点配置指令就可以支持 URL 美 化: location / { try_files $uri $uri/ /index.php?$query_string; } 当然,使用 Homestead 或 Valet 的话,以上配置已经为你配置好, 可以忽略上述配置。 本文档由学院君提供 学院君致力于提供优质 $sitePath、$siteName 和 $uri 值作为参数,其 中 $sitePath 表示站点目录,如 ~/Sites/my-project, 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 106 $siteName 表示主域名部分,如 my-project,而 $uri 则是输入的 请求地址,如 /foo/bar。0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.2 中文文档中,你需要通过 Route::model 方法告诉 Laravel 注入 App\User 实例以匹 配路由定义中的 {user} 参数。 现在,在 Laravel 5.2 中,框架将会基于相应 URI 片段自动注入模型,从而允许你快速 访问需要的模型实例。 如果路由参数片段 {user} 匹配路由闭包或控制器方法中相应变量 $user,并且被类型声明 为一个 Eloquent 模型类的话,Laravel 5.2 支持“隐式模型绑定”,以便在路由和控制器中基于 URI 标识符自动注入模型 实例。然而,这也改变了路由和控制器中类型提示模型实例这一行为。 如果你之前在路由或控制器中类型提示了模型实例,并且希望注入一个空的模型实例,那 么现在应该移除这个类型提示然后在路由或控制器中直接创建一个新的模型实例;否则, Laravel 将会基于路由 URI 的标识符试图从数据库获取一个已存在的模型实例。 IronMQ 所有应用路由都定义在 App\Providers\RouteServiceProvider 类载入 的 app/Http/routes.php 文件中。 最基本的 Laravel 路由接收一个 URI 和一个闭包: Route::get('foo', function () { return 'Hello World'; }); 本文档由 Laravel 学院(LaravelAcademy0 码力 | 377 页 | 4.56 MB | 1 年前3
Learning LaravelRoute::get('user/{id}', 'UserController@show'); Now, when a request matches the specified route URI, the show method on the UserController class will be executed. Of course, the route parameters will informing you of the HTTP verbs and URIs they handle. Actions Handled By Resource Controller Verb URI Action Route Name GET /photos index photos.index GET /photos/create create photos.create POST /photos >Message:{{ $e['message'] }} Action: {{ $action }} URI: {{ $path }} Line: {{ $e['line'] }} 0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.1 中文文档中,使用如下站点配置指令就可以支持 URL 美化: location / { 本文档由 Laravel 学院(LaravelAcademy.org)提供 11 try_files $uri $uri/ /index.php?$query_string; } 当然,使用 Homestead 的话,以上配置已经为你配置好以支持 URL 美化。 2.2 环境配置 基于应用运行环境 大部分路由都定义在被 App\Providers\RouteServiceProvider 类载入的 app/Http/routes.php 文件中。 最基本的 Laravel 路由接收一个 URI 和一个闭包: Route::get('/', function () { return 'Hello World'; }); Route::post('foo/bar', function $url = url('foo'); 本文档由 Laravel 学院(LaravelAcademy.org)提供 19 2、路由参数 2.1 必选参数 有时我们需要在路由中捕获 URI 片段,比如,如果想要从 URL 中捕获用户 ID,可以通过如 下方式定义路由参数: Route::get('user/{id}', function ($id) { return 'User0 码力 | 307 页 | 3.46 MB | 1 年前3
《Slides Dev Web》 09. Services Web
15https://fr.wikipedia.org/wiki/Representational_state_transfer 3 – Identification des ressources (URI) – Manipulation des ressources par des représentations – Messages autodescriptifs – Hypermédia comme fichier PDF, image, flux RSS, fichier sonore, … REST • Principes – Identifier les ressources avec des URI (noms) – Actions déterminées par des méthodes HTTP (verbes) ∗ GET : READ (sûre) ∗ POST : CREATE ∗ L’appel d’une ressource avec des verbes différents produira un résultat différent : Effet Route Verbe URI (ressource) Description Index GET /blogs Affiche la liste New GET /blog/new Affiche formulaire création0 码力 | 6 页 | 47.90 KB | 1 年前3共 12 条- 1
- 2













