<?php
$text = file_get_contents('https://www.jbxue.com/');
preg_match_all('/<img[^>]*>/i', $text, $match);
print_r($match);
?>
<?php
$text = file_get_contents('https://www.jbxue.com/');
preg_match('/<img[^>]*>/Ui', $text, $match);
print_r($match);
?>
<?php
$text = file_get_contents('https://www.jbxue.com/');
preg_match('/<div[^>]*id="PostContent"[^>]*>(.*?)<\/div>/si', $text, $match);
print($match[0]);
?>
<?php
$text = file_get_contents('https://www.jbxue.com/');
preg_match('/<div[^>]*id="PostContent"[^>]*>(.*?)<\/div>/si', $text, $match);
preg_match('/<img[^>]*>/Ui', $match[0], $match2);
print_r($match2[0]);
?>
關鍵旗標說明:i 不分大小寫,U 非貪婪模式,s 讓 . 匹配換行符。