swimmingwhale
2/27/2019 - 1:32 PM

php正则表达式从xml中获取指定标签中的内容


public function request($name)
{
    preg_match("/\<$name.*?>(.*?)<\/$name\>/iu", $this->xmlstr, $matches);
    return isset($matches[1]) ? $matches[1] : null;
}