// 追加内容
$file = fopen(dirname(dirname(__FILE__)).'/index.htm', 'r');
$content = fread($file, filesize(dirname(dirname(__FILE__)).'/index.htm'));
$hello = '<link type="text/css" rel="stylesheet" href="/css/hover.css" />' . PHP_EOL . $content;
fclose($file);
$file = fopen(dirname(dirname(__FILE__)).'/index.htm', 'w');
echo fwrite($file, $hello);
fclose($
Change the html file suffix to .php and add the original php code directly to the required location on the page