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

Commite99defc

Browse files
alexcoventryweaverryan
authored andcommitted
The use of the undefined variable $router is confusing if you jump straight tohttp://symfony.com/doc/current/book/routing.html#generating-absolute-urls in the docs (as I did.)
1 parente24376c commite99defc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎book/routing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). To generate
12011201
an absolute URL, simply pass ``true`` to the third argument of the ``generate()``
12021202
method::
12031203

1204-
$router->generate('blog_show', array('slug' => 'my-blog-post'), true);
1204+
$this-get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true);
12051205
// http://www.example.com/blog/my-blog-post
12061206

12071207
..note::
@@ -1212,7 +1212,7 @@ method::
12121212
scripts run from the command line, you'll need to manually set the desired
12131213
host on the ``RequestContext`` object::
12141214

1215-
$router->getContext()->setHost('www.example.com');
1215+
$this-get('router')->getContext()->setHost('www.example.com');
12161216

12171217
..index::
12181218
single: Routing; Generating URLs in a template
@@ -1223,7 +1223,7 @@ Generating URLs with Query Strings
12231223
The ``generate`` method takes an array of wildcard values to generate the URI.
12241224
But if you pass extra ones, they will be added to the URI as a query string::
12251225

1226-
$router->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1226+
$this-get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony'));
12271227
// /blog/2?category=Symfony
12281228

12291229
Generating URLs from a template

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp