$url=http1208496165808hls244630002771954tsphp 正则匹配得到4630002771954
你可以使用正则表达式来匹配得到4630002771954。以下是一个示例代码:
$url = 'http://120.84.96.165:808/hls/24/4630002771954.ts';
$pattern = '/\/(\d+)\.ts$/';
preg_match($pattern, $url, $matches);
$number = $matches[1];
echo $number;
这段代码中,使用了正则表达式/\/(\d+)\.ts$/来匹配URL中的数字部分。$matches数组将包含匹配的结果,其中索引为1的元素即为所需的数字部分。最后使用echo语句输出该数字。
原文地址: https://www.cveoy.top/t/topic/iqTl 著作权归作者所有。请勿转载和采集!