1 回答

TA貢獻1155條經驗 獲得超0個贊
1. 例如你的頁面看起來像
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>This is Sample page</p>
</body>
</html>
2. 您的所有 20,000 個文件應位于同一目錄中,示例如下
mydirectry/file1.html mydirectry/file2.html mydirectry/file3.html
很快
mydirectry/file20000.html
3. 您可以使用如下 PHP 代碼來更新所有文件
$allhtmlfiles = glob("mydirectry/*.html");
foreach($allhtmlfiles as $singlehtmlfile){
$htmlupdatedcontent = '';
$html = '';
$html = file_get_content($singlehtmlfile);
$htmlupdatedcontent = str_replace("<!doctype html>",'<?php require_once('myphpfile.php'); ?>'."\n".'<!doctype html>',$html);
file_put_content($singlehtmlfile, $htmlupdatedcontent);
}
4.您可以在此文件(myphpfile.php)中添加按鈕信息。
- 1 回答
- 0 關注
- 101 瀏覽
添加回答
舉報