当前位置:Gxlcms > PHP教程 > 正则表达式匹配时,怎么去掉引号

正则表达式匹配时,怎么去掉引号

时间:2021-07-01 10:21:17 帮助过:16人阅读

正则表达式匹配时,如何去掉引号
我在php中运行如下程序
$str = '\'\'';
$soImages = '/\'(.*?)\'/';
preg_match_all( $soImages, $str, $thePics );
$allPics = count($thePics[0]);
if( $allPics > 0 ){
echo $thePics[0][0];
}
?>

返回的结果为'http://xxx/xxx.jpg'
我希望返回结果直接是http://xxx/xxx.jpg
请问如何让正则匹配返回不带单引号的结果?
------解决方案--------------------
echo $thePics[1][0];

人气教程排行