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

WBOY
Release: 2016-06-23 14:03:37
Original
1641 people have browsed it

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);

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!