我有一个具有多重值的数据库值。我想要的是这样的部分:
"dynamic_key";s:11:"single_name"
如何匹配以“dynamic_key”开头但提取并保存结尾“single_name”的所有值到数组中?
例如:
"save_to_database";b:0;s:21:"dynamic_default_value";b:1;s:11:"dynamic_key";s:2:"id";}i:1;a: 8:
{s:2:"id";i:36;s:4:"type";s:6:"hidden";s:5:"label";s:10:"user_login";s:13:" default_value";s:12:"{user_login}";s:9:"is_hidden";b:0;s:16:"save_to_database";b:0;s:21:"dynamic_default_value";b:0;s :11:"dynamic_key";s:0:"";}i:2;a:28:{s:2:"id";i:1;s:4:"type";s:4:"text ";s:5:"标签";s:15:"שם האומן";s:11:"描述";s:0:"";s:8:"必需";b:0;s:13: "default_value";s:0:"";s:7:"工具提示";s:0:"";s:19:"clear_default_value";b:0;s:19:"reset_default_value";b:1; s:11:"admin_label";s:0:"";s:16:"required_message";s:0:"";s:9:"is_hidden";b:0;s:16:"save_to_database";b:0;s:15:"label_placement";s:7:"inherit";s:11:"label_width";s:0:"";s:12:"tooltip_type";s:7: "继承";s:13:"工具提示事件";s:7:"继承";s:18:"prevent_duplicates";b:0;s:23:"duplicate_found_message";s:0:"";s:5 :"logic";b:0;s:12:"logic_action";s:4:"show";s:11:"logic_match";s:3:"all";s:11:"logic_rules";a :0:{}s:21:"dynamic_default_value";b:1;s:11:"dynamic_key";s:11:"artist_name";s:6:"styles";a:0:{}s:7 :"过滤器";a:1:{i:0;a:4:tooltip_event";s:7:"继承";s:18:"prevent_duplicates";b:0;s:23:"duplicate_found_message";s:0:"";s:5:"逻辑";b:0; s:12:"logic_action";s:4:"show";s:11:"logic_match";s:3:"all";s:11:"logic_rules";a:0:{}s:21: "dynamic_default_value";b:1;s:11:"dynamic_key";s:11:"artist_name";s:6:"styles";a:0:{}s:7:"filters";a:1: {i:0;a:4:tooltip_event";s:7:"继承";s:18:"prevent_duplicates";b:0;s:23:"duplicate_found_message";s:0:"";s:5:"逻辑";b:0; s:12:"logic_action";s:4:"show";s:11:"logic_match";s:3:"all";s:11:"logic_rules";a:0:{}s:21: "dynamic_default_value";b:1;s:11:"dynamic_key";s:11:"artist_name";s:6:"styles";a:0:{}s:7:"filters";a:1: {i:0;a:4:艺术家名称";s:6:"styles";a:0:{}s:7:"过滤器";a:1:{i:0;a:4:艺术家名称";s:6:"styles";a:0:{}s:7:"过滤器";a:1:{i:0;a:4:
因此,如果我在此文本上运行 preg_match_all 我将有一个包含:id
,的数组artist_name
。