<?php
// 获取网页源码
$html = file_get_contents('http://www.tugaga.com');
// 使用正则表达式匹配特定部分
$pattern = '/<div class="content">(.*?)<\/div>/s';
preg_match($pattern, $html, $matches);
// 提取匹配到的内容
if (isset($matches[1])) {
$content = $matches[1];
// 进一步处理截取到的内容,例如去除标签等操作
$content = strip_tags($content);
// 显示截取到的内容
echo $content;
} else {
echo "未找到匹配的内容";
}
?>