简体   繁体   中英

Array serialize issue in smarty tpl

I want save the output of an array in a hidden div in smarty tpl. I used {$product|@print_r} to do that. But I want that array to be serialized. Is there any way to get serialized $product array. Pls help.

best practice for serializing:

//serialize
$string = base64_encode(serialize($array));

//unserialize
$array = unserialize(base64_decode($string));

您是否尝试过{$ product | @serialize}?

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