How does tp5 implement a template request function based on ID and return the name of the requested ID?
“橙”-景安服务器**
“橙”-景安服务器** 2018-06-05 14:24:37
0
2
1291

How to implement template request function in tp5 and return the name of the requested ID

[Product table]: product
----------------- ------
id | name
1 | PC website
2 | Mobile website
3 | Mini program
-------------- ---------

[Customer table]: client
-------------------------- ---------
id | name | product_id
1 | Customer A | ["1","2","3"]
--------- --------------------------


When rendering data in the "Customer Template" list, how to use "prodect_id" "The ID inside gets the name value corresponding to the ID in the "product" table. If it is ajax, there is a delay in returning the data. I want to get it by calling the function method directly through the template; if there are other better methods, I hope you can tell me

“橙”-景安服务器**
“橙”-景安服务器**

reply all(1)
PeterZhu

It is recommended to create a custom function directly in common.php to solve the problem

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template