Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php提取第n个字符和第n个字符之间的文本_Php - Fatal编程技术网

php提取第n个字符和第n个字符之间的文本

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/

如何使用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/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