2011-04-11 50 views

回答

1
preg_replace_callback('@{table}(.*?){/table}@', 
    function ($mat) { return strip_tags($mat[0]); }, $s); 

对于像

aa {table} This is <strong>table</strong> {/table} kk

这会给

aa {table} This is table {/table} kk
+0

谢谢你解决了我的问题 – user523626 2011-04-11 11:33:47

0
$input = '{table} This is <strong>table</strong> {/table}'; 
$output = ''; 
preg_match('/\{table\}(.*?)\{\/table\}/', $input, $matches); 

if (!empty($matches[1])) { 
    $output = stripslashes($matches[1]); 
} 
相关问题