字符串存储在$ variable中。$ variable看起来像:
plusCardName: 'Plus Card', over the hills 'fire' city 'song'.
需要输出“”内的内容。输出为:
Plus Card
fire
song
检查一下:
function get_delimited($str, $delimiter='"') {
$escapedDelimiter = preg_quote($delimiter, '/');
if (preg_match_all('/' . $escapedDelimiter . '(.*?)' . $escapedDelimiter . '/s', $str, $matches)) {
return $matches[1];
}
}
$words = get_delimited("'Plus Card', over the hills 'fire' city 'song'","'");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句