仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2184|回复: 19
打印 上一主题 下一主题

[学习教程] PHP网页设计这个可是好器材,今后人人能够会用上哦...

[复制链接]
兰色精灵 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-16 00:28:54 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
不可能吃饭的时候咬了自己一下舌头就从此不吃饭了不是?放下畏惧,继续努力,咱们是来征服它的,而不是被它征服的,振奋起来吧同志。xhtml   <?

if (!empty($type)) {
    if ($type == "path") {
        if (!empty($path)) {
            if (file_exists($path) && is_file($path)) {
                $file = file($path);
                if (substr($file[0],0,9) != "<!DOCTYPE") $doctype=0;
                    $file = join('', $file);
                } else {
                    die ("No such file.");
                }
            } else {
                die ("No file specified.");
            }
        } elseif ($type == "file") {
            if (!empty($file)) {

            } else {
                die ("No file specified.");
            }
    } else {
        die ("No file specified.");
    }

# specify html file, check for doctype
//$file = file("file.html");
//if (substr($file[0],0,9) != "<!DOCTYPE") $doctype=1;
//$file = join('', $file);

# make tags and properties lower case, close empty elements, quote all properties
$search  = array ("'(<\/?)(\w+)([^>]*>)'e",
                   "'(<\/?)(br|input|meta|link|img)([^>]*)( />)'ie",
                   "'(<\/?)(br|input|meta|link|img)([^>]*)(/>)'ie",
                   "'(<\/?)(br|input|meta|link|img)([^>]*)(>)'ie",
                   "'(\w+=)(\w+)'ie",
                   "'(\w+=)(.+?)'ie");
$replace = array ("'\\1'.strtolower('\\2').'\\3'",
                   "'\\1\\2\\3>'",
                   "'\\1\\2\\3>'",
                   "'\\1\\2\\3 /\\4'",
                   "strtolower('\\1').'\"\\2\"'",
                   "strtolower('\\1').'\\2'");
$file = preg_replace($search, $replace, $file);

# return xhtml-compliant document
echo "<textarea cols=\"100\" rows=\"20\">";
if (isset($doctype)) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">'."\n";
echo stripslashes(stripslashes(stripslashes($file)));
echo "</textarea>";

} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<head><title>HTML -> XHTML Convertor</title></head>

<body>

<!-- WARNING: this input method is a security risk on open servers //-->
<form action="<?=$PHP_SELF?>" method="get">
<input type="hidden" name="type" value="path" />
<font face="verdana">File path:</font> <input type="text" name="path" size="50" />
<input type="submit" value="Submit" />
</form>

<b><font face="verdana">OR</font></b><br /><br />

<form action="<?=$PHP_SELF?>" method="get">
<input type="hidden" name="type" value="file" />
<font face="verdana">File contents:</font><br />
<textarea name="file" rows="10" cols="50"></textarea><br />
<input type="submit" value="Submit" />
</form>

</body>

</html>
<?
}
?>
原文自www.evilwalrus.com  PHP成功的插入,删除,更新数据的时候,显然,你已经距离成功指日可待了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-10 14:15

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表