Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 查找用户定义的开始和结束标记之间的所有内容_Php - Fatal编程技术网

Php 查找用户定义的开始和结束标记之间的所有内容

Php 查找用户定义的开始和结束标记之间的所有内容,php,Php,如何找到打开{table}和关闭标记{/table}之间的所有内容 e、 g {table}这是table{/table} 我希望所有html标记都应该在{table}标记中删除$input='{table}这是table{/table}'; $input = '{table} This is <strong>table</strong> {/table}'; $output = ''; preg_match('/\{table\}(.*?)\{\/table\}/'

如何找到打开{table}和关闭标记{/table}之间的所有内容 e、 g

{table}这是table{/table}
我希望所有html标记都应该在{table}标记中删除

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

if ( !empty($matches[1]) ) {
    $output = stripslashes($matches[1]);
}
$output=''; 预匹配('/\{table\}(.*?\{\/table\}/',$input,$MATCHS); 如果(!empty($matches[1])){ $output=stripslashes($matches[1]); }
比如

aa {table} This is <strong>table</strong> {/table} kk aa{table}这是table{/table}kk 这将给

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