简体   繁体   中英

As a result I redirected to my ID editing form using twig and php

I am learning to use twig and I do not know how to redirect to an editing path through ID

In pure PHP it would be like this for example:

<a href="update.php?id='.$row["id"].'">edit</a>

In twig to redirect to a location I use my route and the URL filter for example:

<a href="{{'admin' | url}}">Back</a>

How do I achieve this: <a href="update.php?id='.$row["id"].'">editar</a> but using twig.

First make sure you have defined the route with the parameters in your routing file.

So if you want to generate url for the route: /update.php?id={id} then you can pass the id parameter like this:

{{ url('update.php', {'id': '. $row['id'] .'}) }}

Documentation

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