mr_eiffel 2020-04-14 01:15:32
用正则匹配一对单引号或一对双引号中的内容
$str = 'var ori_head_img_url = "http://wx.qlogo.cn/mmhead/Q3auHgzwzM6KrtMAC0Mia9xONJF2lg8FvaD4vcwkXLYpZSH3iaUvhEEA/132";
var msg_title = '广州地铁拿地!白云地铁上盖或卖3.5万+!'.html(false);
var msg_desc = "三条地铁还有一线江景!";';
$isMatched = preg_match_all('/([\'"])(?:(?!\1).)*?\1/', $str, $matches);
var_dump($isMatched, $matches);
"http://wx.qlogo.cn/mmhead/Q3auHgzwzM6KrtMAC0Mia9xONJF2lg8FvaD4vcwkXLYpZSH3iaUvhEEA/132"
'广州地铁拿地!白云地铁上盖或卖3.5万+!'
"三条地铁还有一线江景!"