Home  >  Article  >  Backend Development  >  生成的静态页 怎么把里面PHP地址改成html地址

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

WBOY
WBOYOriginal
2016-06-23 14:03:371642browse

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
'; ?>

先只生成了 

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










回复讨论(解决方案)

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

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn