당신은 수를 닫는 큰 따옴표 마지막 슬래시 때까지 URL 본문과 일치하는 속성의 시작과 일치 문자열을 정규식으로 나눕니다. 당신은 ID 코드를 나열 할 경우
$re = '/\<iframe[^\>]+src\="(.+?)\/([A-Za-z0-9]+)"/';
$str = '<iframe src="https://www.example.com/embed/ph57d6z9fa1349b" frameborder="0" height="481" width="608" scrolling="no"></iframe>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
('ph57d6z9fa1349b'같은) 당신은이 작업을 수행 할 수 있습니다이 과잉이
<?php
$re = '/\<iframe[^\>]+src\="(.+?)\/([A-Za-z0-9]+)"/';
$str = '<iframe src="https://www.example.com/embed/ph57d6z9fa1349b" frameborder="0" height="481" width="608" scrolling="no"></iframe>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
foreach ($matches as $match) {
$id = $match[2]; // The required id code
echo $id; // Echo it
}
?>
인가? [https://3v4l.org/v01sD](https://3v4l.org/v01sD). xD – FirstOne