PHP로 함수를 작성하려고하는데,이 함수는 mySQL 데이터베이스를 통해 반복되고 모든 조건부 주석을 삭제합니다.다중 회선 조건문을 preg_replace하는 PHP 함수
이 같은 모습을 대체 할 텍스트 :
<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG /> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:DoNotShowRevisions /> <w:DoNotPrintRevisions /> <w:DoNotShowMarkup /> <w:DoNotShowComments /> <w:DoNotShowInsertionsAndDeletions /> <w:DoNotShowPropertyChanges /> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /><![endif]-->
것은 여기 내 코드는 아무것도 일치하지 않는 것
$content = array('1' => $my_text_with_conditional_quotes)
foreach($content as $id => $v){
print $v .' <br>';
$str = addcslashes(preg_replace("/<!(--)?(?=\[)(?:(?!<!\[endif\]\1>).)*<!\[endif\]\1>/s",'',$v));
print $str . '<br>';
print $id . '<br>';
exit;
}
입니다. 나는 무엇을 놓치고 있습니까?
오류를 잡아 주셔서 감사합니다. 작동 중입니다. – alockwood05
@AlexLockwood : 천만에요. – Toto