php 生成css文件怎么打开,php生成html文件的多种步骤介绍

//定义日期函数

function

getdatetime()

{

$datetime=getdate();

$strReturn=$datetime["year"]."-";

$strReturn=$strReturn.$datetime["mon"]."-";

$strReturn=$strReturn.$datetime["mday"];

return

$strReturn;

}

//定义时间函数(文件名)

function

gettime()

{

$times=getdate();

$strtime=$times["year"];

$strtime=$strtime.$times["mon"];

$strtime=$strtime.$times["mday"];

$strtime=$strtime.$times["minutes"];

$strtime=$strtime.$times["seconds"];

return

$strtime;

}

?>

//判断提交值是否为空

$submit=$_POST["submit"];

//定义文件头部信息

$htmltitle=$_POST["htmltitle"];

//定义文件内容

$htmlbody=$_POST["htmlbody"];

if

($submit)

{

//定义html文件标签

$html1=$html1."";

$html1=$html1."

";

$html1=$html1."

";

$html1=$html1.$htmltitle;

$html1=$html1."

";

$html1=$html1."

http-equiv='Content-Type' content='text/html;

charset=gb2312'>";

$html1=$html1."";

$html1=$html1."

";

$html1=$html1."

border='1' width='740' cellpadding='2' cellspacing='0' bordercolordark='#f7f7f7'

bordercolorlight='#cccccc'>

height='30'>

size='3'>";

$html1=$html1.$htmltitle;

$html1=$html1."

";

$html1=$html1."

size='2'>";

$html1=$html1.$htmlbody;

$html1=$html1."

";

$html1=$html1."";

$html1=$html1."";

//判断今天的文件夹是否存在

if (!is_dir(getdatetime()))

{

//如果不存在就建立

mkdir(getdatetime(),0777);

}

//写成html文件

$filedir=getdatetime();

$filename=gettime();

$filename=$filename.".html";

$fp=fopen("$filedir/$filename","w");

fwrite($fp,$html1);

fclose($fp);

echo

"";

}

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值