Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb9635e

Browse files
committed
Deprecate the Request::get() method
1 parent3fa34a9 commitdb9635e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎create_framework/front_controller.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Let's see it in action::
3838
// framework/index.php
3939
require_once __DIR__.'/init.php';
4040

41-
$name = $request->get('name', 'World');
41+
$name = $request->attributes->get('name', 'World');
4242

4343
$response->setContent(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));
4444
$response->send();
@@ -98,7 +98,7 @@ Such a script might look like the following::
9898
And here is for instance the new ``hello.php`` script::
9999

100100
// framework/hello.php
101-
$name = $request->get('name', 'World');
101+
$name = $request->attributes->get('name', 'World');
102102
$response->setContent(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));
103103

104104
In the ``front.php`` script, ``$map`` associates URL paths with their
@@ -190,7 +190,7 @@ And the ``hello.php`` script can now be converted to a template:
190190
..code-block::html+php
191191

192192
<!-- example.com/src/pages/hello.php -->
193-
<?php $name = $request->get('name', 'World') ?>
193+
<?php $name = $request->attributes->get('name', 'World') ?>
194194

195195
Hello <?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>
196196

‎create_framework/http_foundation.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Now, let's rewrite our application by using the ``Request`` and the
141141

142142
$request = Request::createFromGlobals();
143143

144-
$name = $request->get('name', 'World');
144+
$name = $request->attributes->get('name', 'World');
145145

146146
$response = new Response(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));
147147

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp