2016-03-15 35 views
-2

如何使用PHP獲取刺痛bewteen第7和第8/PHP中提取文本

http://uk.soccerway.com/matches/2015/01/01/england/premier-league/stoke-city-fc/manchester-united-fc/1703889/?ICID=HP_MS_01_01 

所以上述搶英格蘭

回答

1

喜歡的東西:

$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' 

個爲explode()

0

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