热搜:NVER node 开发 php

生成的静态页 怎么把里面PHP地址改成html地址

2024-09-06 15:10:01
生成的静态页 怎么把里面PHP地址改成html地址

define('CACHE_FILE', '111.html');function callback($buffer) {  file_put_contents(CACHE_FILE, $buffer, FILE_APPEND);  return $buffer; //不需显示页面内容就 return '';}file_put_contents(CACHE_FILE, '');ob_start("callback", PHP_OUTPUT_HANDLER_START);


jingtai.php
<?php echo''; ?>

先只生成了 

jingtai.html
怎么把123.php改成123.html呢 










回复讨论(解决方案)

你在
file_put_contents('111.html', $buffer);
前先执行
$buffer = preg_replace('/(href=.+?)\.php/', '$1.html', $buffer);

不过规则可能没那么简单,你想好了再说