0
請幫我解決這個問題。preg_match_all獲取HTML中的鏈接,樣式和腳本標記
我的代碼是:
preg_match_all('/<(link|style|script)(.*?)(\/>|<\/style>|<\/script>)/i', $tpl_content, $styles);
它不會,如果有 '>' 鏈接標籤結束時,如果鏈接標籤結束與 '/>'
謝謝你的工作(只工作
請幫我解決這個問題。preg_match_all獲取HTML中的鏈接,樣式和腳本標記
我的代碼是:
preg_match_all('/<(link|style|script)(.*?)(\/>|<\/style>|<\/script>)/i', $tpl_content, $styles);
它不會,如果有 '>' 鏈接標籤結束時,如果鏈接標籤結束與 '/>'
謝謝你的工作(只工作
不知道,如果你想標記之間的一切,嗯,這是在未拍攝組在此:
/(<(?:link|style|script)(?:.*?)(?:\/)?>)(?:(?<=^|>)[^><]+?(?=<|$))(<\/(?:style|script)>)?/i
我會在這個順便使用PREG_SET_ORDER標誌。 [0]是全部匹配,[1]是開始/全部,並且[2]是可選的結束標記
$string = '<link lan="hello"/><script language=\'javascript\'>$(document).ready(function() {}</script>'
$returnValue = preg_match_all('/(<(?:link|style|script)(?:.*?)(?:\\/)?>)(?:(?<=^|>)[^><]+?(?=<|$))(<\\/(?:style|script)>)?/i', $string , $matches, PREG_SET_ORDER);