简体   繁体   中英

How to create a volt URL with parameters

I want to create a URL using volt (Phalcon).

I have tried:

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

However that produces a URL like:

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]) }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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