石家庄网站设计:把动态网页转为静态网页的PHP代码

时间:2009-07-04 11:03来源:网络营销管理学院 作者:网络营销专家 点击:次 [收藏到本地收藏夹]
把动态网页转为静态网页的PHP代码 以下代码保存为html.php: < html >< head >< title > 把动态网页转为静态网页 </ title ></ head >< body >< form enctype = 'multipart/form-data' action = "ht

把动态网页转为静态网页的PHP代码

以下代码保存为html.php:





<

html

><

head

><

title

>

把动态网页转为静态网页

</

title

></

head

><

body

><

form enctype

=

'multipart/form-data'

action dedecms.com

=

"html.php"

method

=

"post"

>

动态网页地址:

<

input type

=

"text"

size

=

"32"

name

=

"url"

value

=

""

/>< 内容来自dedecms

br

/>

生成静态网页:

<

input type

=

"text"

size

=

"12"

name

=

"file"

value

=

""

/><

select name

=

type

><

option value

内容来自dedecms


=

".htm"

>.

htm

</

option

><

option value

=

".html"

selected

>.

html

</

option

></

select

><

input type

=

"hidden"

name 织梦内容管理系统

=

"action"

value

=

"html"

/><

input type

=

submit value

=

'确定'

></

form

><?

php

if(

$_POST

[

'action'

]==

'html'

){                    if( copyright dedecms

$_POST

[

'file'

]==

""

|| !

ereg

(

"^[a-zA-Z0-9 ]*$"

,

$_POST

[

'file'

])){                                        echo

"<font color='red'>错误!文件名只能包含英文和数字!</font>"

;                                        exit;                    }                    

copyright dedecms



$content

= @

file_get_contents

(

$_POST

[

'url'

]);                    if(empty(

$content

)){                                        echo

"<font color='red'>错误!无法获取该网页内容!</font>"

;                                        exit;                    }                     织梦好,好织梦

$filename

=

"html/"

.

$_POST

[

'file'

].

$_POST

[

'type'

];                    if(!

is_dir

(

"html"

))

mkdir

(

"html"

,
织梦内容管理系统
0777

);                    

$fp

=

fopen

(

$filename

,

"w "

);                    

$content

=

"<base href=\""

.

$_POST

[

'url'

].

"\">" 内容来自dedecms

.

$content

;                    

fwrite

(

$fp

,

$content

);                    

fclose

(

$fp

);                    echo

"察看静态网页:<a href='"

.

$filename
dedecms.com
.

"' target='_blank'>"

.

$_POST

[

'file'

].

$_POST

[

'type'

].

"</a>"

;}

?>
</body></html>

织梦内容管理系统

 

织梦内容管理系统

 

本文来自织梦

  dedecms.com

     更多精彩:http://www.cnseoo.net                  www.hbmobiles.cn

copyright dedecms

顶一下
(0)
0%
踩一下
(0)
0%
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
营销百科 娱乐资讯