php去掉字符串前后的引号的方法是:可以先通过preg_match()函数判断字符串是否以引号开头、结尾,然后再通过substr()函数与strlen()函数来提取引号中的字符串即可。
function remove_quote(&$str) {
if (preg_match("/^\"/",$str)){
$str = substr($str, 1, strlen($str) - 1);
}
//判断字符串是否以'"'结束
if (preg_match("/\"$/",$str)){
$str = substr($str, 0, strlen($str) - 1);;
}
return $str;
} 以上就是php如何去掉字符串前后的引号的详细内容,更多请关注 模板之家(www.mb5.com.cn) 其它相关文章! |