简体   繁体   English

如何使用参数创建伏特URL

[英]How to create a volt URL with parameters

I want to create a URL using volt (Phalcon). 我想用伏特(Phalcon)创建一个URL。

I have tried: 我努力了:

{{ url("order/view/", ["id" :order.id]) }}

However that produces a URL like: 但是会生成如下URL:

http://localhost/gateway-new/order/view/?id=7

Whereas I would like the url to look like: 虽然我希望网址看起来像:

http://localhost/gateway-new/order/view/id/7

Any idea how to do this correctly? 知道如何正确地做到这一点?

{{ url("order/view/id/" ~  order.id) }}

if you have a route defined like 如果你有一个像这样的路线

$router->add('order/view/id/:int', array(
    'controller' => 'order', 
    'action' => 'view',
    'id' => 1))->setName('order-view');

you could use 你可以用

{{ url(['for': 'order-view', 'id': order.id]) }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM