php提取第n个字符和第n个字符之间的文本
如何使用php在7号和8号之间获得sting/php提取第n个字符和第n个字符之间的文本,php,Php,如何使用php在7号和8号之间获得sting/ http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01 因此,上面提到的php函数explode就是这样做的 了解更多信息:类似于: $url = 'http://uk.soccerway.com/matches/2015/01/01/england/
http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01
因此,上面提到的php函数explode就是这样做的 了解更多信息:类似于:
$url = 'http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01';
$tokens = explode('/', $url);
echo $tokens[7]; // 'england'
用于的PHP文档请尝试以下操作:
$n = 7; $m = 8;
$str = "http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01";
$a = explode('/', $str);
echo $a[$n];
像这样,你可以得到任意n和m的随机值
希望这有帮助
和平!xD