init: 项目初始代码

This commit is contained in:
2026-10-14 14:00:29 +08:00
commit cc434cf89f
464 changed files with 66984 additions and 0 deletions

48
extend/utils/FileLog.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
class FileLog
{
private $filepath;
private $filename;
private $handle = null;
private $time;
public function __construct($filepath, $filename)
{
$this->time = date('Y-m-d H:i:s');
$this->filepath = $filepath;
$this->filename = $filename;
$this->init();
}
public function init()
{
if (!is_dir($this->filepath))
{
mkdir($this->filepath, 0777, true);
}
}
public function write($content, $type='err')
{
$str = $type . '=====';
$str .= '当前时间为: ' . $this->time;
$str .= '=====';
$str .= $content . PHP_EOL;
if (substr($this->filepath, -1) == '/')
{
$file = $this->filepath . $this->filename;
}
else
{
$file = $this->filepath . '/' . $this->filename;
}
return file_put_contents($file, $str, FILE_APPEND);
}
}