查看: 5088|回复: 1
打印 上一主题 下一主题

php缓冲代码的实例之一,以供兴趣朋友参考.

[复制链接]
跳转到指定楼层
1#
发表于 2007-10-4 15:08:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
台州网址导航
<?php
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//File:     root.php
//Author:   TZNKTG
//Purpose:  This page is modify website information of base setting  
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

TZNKTG == 'OK' or exit('Forbidden');

if($submit)
{
   $cache = "";
   foreach($editroot as $key=>$val)
   {
        $cache .= "\t\t\t'".$key."' => \"".$val."\",\r\n";
   }
   writeover(R_P."data/root.php","<?php\r\n\$rootindex = array(\r\n".$cache.");\r\n?>");
   adminmsg();
}



include admintemp('header');
$form->header(array(
                 "title" => "网站的基本设置",
                 "action" => "index.php?action=root"
              ));

$form->input(array(
                 "notel" => "网站名称:",
                 "name" => "editroot[website_name]",
                 "value" => $rootindex['website_name']
             ));
$form->input(array(
                 "notel" => "网站地址:",
                 "name" => "editroot[siteurl]",
                 "value" => $rootindex['siteurl'],
                 "noter" => " 请不要以 / 结尾",
             ));
$form->input(array(
                 "notel" => "网站标题:",
                 "name" => "editroot[title]",
                 "value" => $rootindex['title']
             ));
$form->input(array(
                 "notel" => "技术支持中文名称:",
                 "name" => "editroot[cnts]",
                 "value" => $rootindex['cnts']
             ));
$form->input(array(
                 "notel" => "技术支持英文名称:",
                 "name" => "editroot[ents]",
                 "value" => $rootindex['ents']
             ));
$form->input(array(
                 "notel" => "技术支持邮箱:",
                 "name" => "editroot[temail]",
                 "value" => $rootindex['temail'],
                 //"noter" => " 请不要以 / 结尾",
             ));

/*
$form->input(array(
                 "notel" => "程序相对站点根目录路径:",
                 "name" => "editroot[path]",
                 "value" => $rootindex['path'],
                 "noter" => " 如根目录: / ,可留空",
             ));
*/
$form->input(array(
                 "notel" => "每页记录条数:",
                 "name" => "editroot[pagesize]",
                 "value" => $rootindex['pagesize']
             ));
$form->input(array(
                 "notel" => "网站版本号:",
                 "name" => "editroot[version]",
                 "value" => $rootindex['version']
             ));
$form->input(array(
                 "notel" => "数据库备份前缀",
                 "name" => "editroot[dbbak_prefix]",
                 "value" => $rootindex['dbbak_prefix'],
                // "noter" => "用户提交网址使用文本存储于data/post"
             ));
$form->radio(array(
                 "notel" => "数据库是否使用持久连接:",
                 "name" => "editroot[pconnect]",
                 "select" => $rootindex['pconnect']
             ));

$form->footer();
include admintemp('footer');
?>
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
台州维博网络(www.tzweb.com)专门运用PHP+MYSQL/ASP.NET+MSSQL技术开发网站门户平台系统等。
2#
 楼主| 发表于 2007-10-4 15:09:09 | 只看该作者
台州网址导航
附助代码之一

function readover($filename,$method="rb")
{
        if($handle = @fopen($filename,$method))
        {
                flock($handle,LOCK_SH);
                $filedata = @fread($handle,filesize($filename));
                fclose($handle);
        }
        return $filedata;
}
function writeover($filename,$data,$method="rb+",$iflock=1)
{
        @touch($filename);
        $handle = fopen($filename,$method);
        if($iflock)
        {
                flock($handle,LOCK_EX);
        }
        fputs($handle,$data);
        if($method == "rb+") ftruncate($handle,strlen($data));
        fclose($handle);
}
台州维博网络(www.tzweb.com)专门运用PHP+MYSQL/ASP.NET+MSSQL技术开发网站门户平台系统等。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

网站推广
关于我们
  • 台州朗动科技(Tzweb.com)拥有多年开发网站平台系统门户手机客户端等业务的成功经验。主要从事:政企网站,系统平台,微信公众号,各类小程序,手机APP客户端,浙里办微应用,浙政钉微应用、主机域名、虚拟空间、后期维护等服务,满足不同企业公司的需求,是台州地区领先的网络技术服务商!

Hi,扫描关注我

Copyright © 2005-2026 站长论坛 All rights reserved

Powered by 站长论坛 with TZWEB Update Techonolgy Support

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