<?php //HTML a连接正则 $str = ‘‘; $isMatched = preg_match(‘/<a.*?[^<]>.*?<\/a>/‘, $str, $matches); var_dump($isMatched, $matches); //HTML js正则 $str = ‘‘; $isMatched = preg_match(‘/<script[\s\S]*?<\/script>/‘, $str, $matches); var_dump($isMatched, $matches); //HTML img正则 $str = ‘‘; $isMatched = preg_match(‘/<img[^>]*>/‘, $str, $matches); var_dump($isMatched, $matches);
时间: 2024-11-07 22:56:52