Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.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 解析市场链接_Php_Parsing - Fatal编程技术网

Php 解析市场链接

Php 解析市场链接,php,parsing,Php,Parsing,如何在PHP中从links transfermarket站点获取ID(末尾的数字)? 比如说 $endofurl退货/40423 如何摆脱/?解决方案A 假定 $url = "http://www.transfermarkt.co.uk/andriy-pyatov/profil/spieler/40423"; 您可以使用explode拆分url,然后使用end获取最后一个元素(本例中为40423): 解决方案B 如果您确实想使用$endofur: $id = substr($endofurl

如何在PHP中从links transfermarket站点获取ID(末尾的数字)? 比如说

$endofurl退货/40423

如何摆脱/?

解决方案A 假定

$url = "http://www.transfermarkt.co.uk/andriy-pyatov/profil/spieler/40423";
您可以使用
explode
拆分url,然后使用
end
获取最后一个元素(本例中为40423):


解决方案B 如果您确实想使用
$endofur

$id = substr($endofurl, 1);
$id = explode("/", $url);
$id = end($id);
$id = substr($endofurl, 1);