2015-12-10 170 views

回答

2

试试这个:

$head_pos = strpos($html, '</head>'); // find position of the </head> 
$newHtml = substr($html, 0, $head_pos) . $stringToAdd . substr($html, $head_pos); 
+0

它工作得很好。非常感谢你。 –

2

请使用strpos()和SUBSTR()来查找位置,然后添加。