如果你想只得到的数字,你可以做一个preg_match
$re = '/(\d+\/\d+)/s';
$str = 'dfsadsfadsfads~~9/10~~lfkjdskfds';
preg_match($re, $str, $matches);
但如果你能得到整个文档作为一个字符串,你可以做一个preg_match_all
$re = '/(\d+\/\d+)/s';
$str = 'dfsadsfadsfads~~9/10~~lfkjdskfds\ndfsadsfadsfads~~9/10~~lfkjdskfds\n';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
然后在$匹配环