inc_bookfunctions.php
来自「强大的PHP内容管理系统尽量不要让站长把时间都花费在为您修正说明上。压缩包解压」· PHP 代码 · 共 38 行
PHP
38 行
<?php
function GetBookText($cid)
{
global $cfg_cmspath,$cfg_basedir;
$ipath = $cfg_cmspath."/data/textdata";
$tpath = ceil($cid/5000);
$bookfile = $cfg_basedir."$ipath/$tpath/bk{$cid}.php";
if(!file_exists($bookfile)) return '';
else{
$alldata = '';
$fp = fopen($bookfile,'r');
$line = fgets($fp,64);
$alldata = '';
while(!feof($fp)){
$alldata .= fread($fp,1024);
}
fclose($fp);
return trim(substr($alldata,0,strlen($alldata)-2));
}
}
function WriteBookText($cid,$body)
{
global $cfg_cmspath,$cfg_basedir;
$ipath = $cfg_cmspath."/data/textdata";
$tpath = ceil($cid/5000);
if(!is_dir($cfg_basedir.$ipath)) MkdirAll($cfg_basedir.$ipath,$GLOBALS['cfg_dir_purview']);
if(!is_dir($cfg_basedir.$ipath.'/'.$tpath)) MkdirAll($cfg_basedir.$ipath.'/'.$tpath,$GLOBALS['cfg_dir_purview']);
$bookfile = $cfg_basedir.$ipath."/{$tpath}/bk{$cid}.php";
$body = "<"."?php exit();\r\n".$body."\r\n?".">";
@$fp = fopen($bookfile,'w');
@flock($fp);
@fwrite($fp,$body);
@fclose($fp);
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?