使用preg_replace更改<;标题>;php中的标记

使用preg_replace更改<;标题>;php中的标记,php,html,regex,preg-replace,Php,Html,Regex,Preg Replace,因此,我将提供以下代码,例如: $str='<title>Test title here</title><meta name="description" content="test meta content here">'; $jftitle="here title 1"; $jfmeta ="here meta 2"; $str='testtitle here'; $jftitle=“此处标题1”; $jfmeta=“此处为meta 2”; 我有: $s

因此,我将提供以下代码,例如:

$str='<title>Test title here</title><meta name="description" content="test meta content here">';
$jftitle="here title 1";
$jfmeta ="here meta 2";
$str='testtitle here';
$jftitle=“此处标题1”;
$jfmeta=“此处为meta 2”;
我有:

$str=preg_replace(array('/<title>(.*)<\/title>/i','/<meta name="description" content="(.*)">/i'),array('<title>'.$jftitle.'</title>','<meta name="description" content="'.$jfmeta.'">'),$str);
$str=preg_replace(数组('/(.*)/i','//i'),数组('.$jftitle'',''),'',$str);
如果我对$str执行回显,它将返回“”。
有人能给我指出正确的方向吗?

使用
echo-htmlspecialchars($str)