简体   繁体   English

使用 php 从网站链接中提取数字

[英]Extract numbers from website link using php

I would like to extract season number and episode number from websites links with PHP我想从带有 PHP 的网站链接中提取季号和剧集号

Here the example that have the same format I want:这是我想要的具有相同格式的示例:

https://3sk.tube/video-watch-turkish-mosalsal-moases-othman-online-download-episode-38?Drivename=othamn.S02E04.mp4

This is the part that presents at all link: Drivename=othamn.S02E04.mp4这是在所有链接中出现的部分:Drivename=othamn.S02E04.mp4

Where season number is: 2 and episode number is 4其中季节编号为:2 集编号为 4

I would like to extract those season number and episode number using PHP.我想使用 PHP 提取那些季号和剧集号。

$drivename = $_GET['Drivename'];
$season = preg_replace("/^(.*?)(\.S)(.*?)E.+$/", '\\3', $drivename);
$episode = preg_replace("/^(.*?)(\....E)(.*?)\..+$/", '\\3', $drivename);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM