我总是使用preg_match
它,它总是工作正常,但今天我试图在两个 html 标签之间获取内容<code: 1>DATA</code>
我有一个问题,我的代码解释了:
function findThis($data){
preg_match_all("/\<code: (.*?)\>(.*?)\<\/code\>/i",$data,$conditions);
return $conditions;
}
// plain text
// working fine
$data1='Some text...Some.. Te<code: 1>This is a php code</code>';
//A text with a new lines
// Not working..
$data2='some text..
some.. te
<code: 1>
This is a php code
..
</code>
';
print_r(findThis($data1));
// OUTPUT
// [0][0] => <code: 1>This is a php code</code>
// [1][0] => 1
// [2][0] => This is a php code
print_r(findThis($data2));
//Outputs nothing!