“for” 是什么意思? `uri_for` 是什么意思?

发布于 2024-12-05 06:59:31 字数 239 浏览 4 评论 0原文

Catalyst中,我不明白的用途 表示在 $c->URI_for(); 子例程中。

它是 for + some 的缩写(可以是 forward)、首字母缩略词还是其他什么?

In Catalyst, I don't understand what does the for means in the $c->URI_for(); subroutine.

Is it an abbrev for for + something (could be forward), an acronym or something ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

成熟稳重的好男人 2024-12-12 06:59:31

它表示特定 $c 的 URI。

$c->uri_for( $path, @args?, \%query_values? )

将路径与绝对 URI 的 $c->request->base 以及相对 URI 的 $c->namespace 合并,然后返回规范化的 URI目的。如果传递任何参数,它们将被添加到路径的末尾。如果 uri_for 的最后一个参数是哈希引用,则假定它包含 GET 参数键/值对,这些参数将以标准方式附加到 URI。

您还可以选择传递 $action 对象,而不是 $path,该对象将使用 $c->dispatcher-> 解析为路径;uri_for_action;如果@args的第一个元素是一个arrayref,它将被视为要传递给uri_for_action的捕获列表。

就法语而言,可以用 pour 来思考,如 Nom pour le livre(书名),不过,考虑到我上次读这本书已经有二十年了实际上讲的是法语,我可能无意中侮辱了你的传统:-)

It means the URI for whatever that particular $c is.

$c->uri_for( $path, @args?, \%query_values? )

Merges path with $c->request->base for absolute URIs and with $c->namespace for relative URIs, then returns a normalized URI object. If any args are passed, they are added at the end of the path. If the last argument to uri_for is a hash reference, it is assumed to contain GET parameter key/value pairs, which will be appended to the URI in standard fashion.

Instead of $path, you can also optionally pass a $action object which will be resolved to a path using $c->dispatcher->uri_for_action; if the first element of @args is an arrayref it is treated as a list of captures to be passed to uri_for_action.

In terms of French, think of it in terms of pour, as in Nom pour le livre (name for the book) although, given it's been some twenty years since I last actually spoke French, I may have inadverdently insulted your heritage :-)

神回复 2024-12-12 06:59:31

in 不是首字母缩写词。像以下内容一样阅读:

  • uri for Path
  • Uri采取行动

The for in uri_for is not an acronym. Read it like:

  • URI for path
  • URI for action
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文