Skip to main content
edited tags
Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73
Source Link
Tjitse
  • 1.3k
  • 16
  • 28

Magento 2 how to unserialize backend config

I've created Magento 2 module that saves a particular configuration. Screenshot:enter image description here

Now I want to use this value in a frontend block. If I check the core_config table, the value is saved like this:

a:1:{s:18:"_1498478770604_604";a:4:{s:4:"name";s:12:"Number Pi";s:5:"image";s:23:"/media/wysiwyg/test.png";s:4:"text";s:606:"Lorum ipsum";s:20:"activation_attribute";s:1:"1";}}

How can I decode or unserialize this data? I want to turn this data into a (object) array that I can use on the frontend.

I've used the PHP function unserialize() but this didn't work. Also i've searched the Magento 2 JSON decode library, but I didn't find an answer there.

Any help would be appreciated.