2011-04-11 76 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]); 
} 
相關問題