How to implement tp5 template returns the name to which the request ID belongs according to the ID request function

how does tp5 implement the template that returns the name to which the request ID belongs according to the ID request function

< H2 > [Product Table]: product < / H2 >

id | name
1 | PC website
2 | Mobile website
3 | Mini Program

< hr > < H2 > [customer Table]: client < / H2 >

id | name | prodect_id
1 | customer A | ["1", "2", "3"]
2 | customer B | ["1", "2"]
3 | customer C | [1 "," 3 "]

< hr >

when rendering data in the "customer template" list, how to get the name value corresponding to ID in the "prodect_id" table according to the ID in "prodect". If there is a delay in returning the data from ajax, you want to call the function method directly through the template to get it. If there are other better methods, please let me know

.
Php
Mar.17,2021

you directly write the method to get the corresponding name in common.php, and then in the template {: the name of the method you wrote (id)}

Menu