How to get a part of a string from MySQL? -
i have table row
id | text 1 | {"category_layout":"","image":"images\/icon-48-info.png"}
how can image path text inside brackets?
what need this: images/icon-48-info.png (note there 2 slashes in text \ / while need 1 /
edit: simple, , found nice solution:
$json = $row->text; $obj = json_decode($json); echo $obj->{'image'};
no need regexp or else.
read string functions reference, try using regexp or substring_index
Comments
Post a Comment