谢谢大家的帮助,实际上我根本没有使用regex就解决了这个问题。我将wp mpdf插件与wp event manager一起使用,当我尝试将事件页面输出为PDF时,有些内容没有显示,如标题,有些内容。。这就是问题的原因,但经过一些定制,我能够从不同的地方获取内容,问题就解决了。
来自wp mdf的代码。mpdf\\u输出函数中的php
$EM_Event = em_get_event($post->ID, \'post_id\');
$wp_content = \'\';
$header_content = \'<h1></h1>\';
$footer_content = \'\';
$header_content .= \'<h2><a href="\' . get_permalink() . \'" rel="bookmark" title="Permanent Link to \' . the_title(\'\',\'\', false) . \'">\' . the_title(\'\',\'\', false) . \'</a></h2>\';
$header_content .= \'<h3>\'.$EM_Event->output(\'#_EVENTDATES\').\'</h3>\';
$header_content .= \'<h3>\' .$EM_Event->output(\'#_LOCATIONNAME\') . \' - \' .$EM_Event->output(\'#_LOCATIONCOUNTRY\'). \'</h3>\';
$footer_content .= \'<div id="footer">\';
$footer_content .= \'<strong></strong>\';
$footer_content .= "<div>";
$wp_content .= $header_content;
$wp_content .= apply_filters(\'the_content\', $wp_content);
$wp_content .= $footer_content;