用户在php中创建一个html文件 [英] create a html file in php by user

查看:109
本文介绍了用户在php中创建一个html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我想为我的cms创建一个功能,哪个用户可以通过它的命令创建一些静态页面,比如

文件名,内容,图片....



例如,用户可以关于我们..那个文件名是about.php,有一个自定义其中的内容,以及所有这些都是由另一个php页面中的用户给出的。



请推荐我使用哪些php函数来制作这些,tnx

解决方案

这样的代码如何:

  $ fh = fopen($ filename,'w')或死(无法打开文件); 
fwrite($ fh,'< html>< body>');
fwrite($ fh,< h1> $ title< / h1> $ text);
fwrite($ fh,'< / body>< / html>');
fclose($ fh);

其中文件名,标题和文本都填充了某些表单数据,或者从文件中读取。 p>

我希望这是你的意思。


well I want to make a feature to my cms which user can make some static page by its orders , such

file name , Content , picture ....

for example , user can make an about us.. that file name is about.php , have a custom content in it , and all of these are given by a user in another php page

please recommend me to use which php function to make these , tnx

解决方案

How about some code like this:

$fh = fopen($filename, 'w') or die("can't open file");
fwrite($fh, '<html><body>');
fwrite($fh, "<h1>$title</h1>$text");
fwrite($fh, '</body></html>');
fclose($fh);

where filename, title and text are filled with some form data, or read from a file.

I hope this is what you meant.

这篇关于用户在php中创建一个html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆