【发布时间】:2011-08-06 16:40:55
【问题描述】:
我想从一个 php 文件生成一个静态 html 页面并从另一个 php 脚本中保存它。该脚本运行了一堆回显函数,当在浏览器中查看时,这些函数是一个不错的 html 页面。但是当我运行 file_get_contents 时,它会将该文件作为文件系统上的文件打开,而不是作为 url 中的文件。
我需要以 localhost/site/categories.php 的方式调用 file_get_contents 吗?我怎样才能得到这条路?这是错误的代码:
<?php
$file = file_get_contents("categories.php");
file_put_contents("categories.html", $file);
?>
【问题讨论】: