……background-image:url("http://xxx.com/xxx/xxx");……
用php提取代码中的http://xxx.com/xxx/xxx,正则表达式应该怎么写
ä¸é¢çæµè¯ä»£ç è°è¯éè¿ï¼æ£ç¡®è¿è¡ï¼å¸æå¯¹ä½ ææ帮å©ï¼
<?php
$s='â¦â¦background-image:url("http://xxx.com/xxx/xxx");â¦â¦';
if (preg_match('|background-image:url\("([^"]*)"\)|', $s, $reg)) echo $reg[1];
?>
<?php
$s='â¦â¦background-image:url("http://xxx.com/xxx/xxx");â¦â¦';
if (preg_match('|background-image:url\("([^"]*)"\)|', $s, $reg)) echo $reg[1];
?>
温馨提示:答案为网友推荐,仅供参考