自己写了一个文本式留言板大神勿喷第一次发求过。。。 无 ?php/*** 留言板类* qq232025079@126.com* 2013/11/17*/class message{public static $file = './message.txt'; //文件地址/*** 写入** param array data 要保存的信息(可以是二维数组)*/public sta
自己写了一个文本式留言板 大神勿喷 第一次发 求过。。。
<?php /** * 留言板类 * qq232025079@126.com * 2013/11/17 */ class message{ public static $file = './message.txt'; //文件地址 /** * 写入 * * param array data 要保存的信息(可以是二维数组) */ public static function put($data){ if(empty($data)) return false; $text = self::setArray($data); file_put_contents(self::$file,$text); } /** * 获取 * * return array */ public static function get(){ $file = file_get_contents(self::$file); eval("\$return = {$file};"); return $return; } /* * 将数组变成字符串形式 * * return string */ protected static function setArray($arr){ $return = 'array('; foreach($arr as $key=>$val){ if(is_array($val)){ $return .= "'{$key}'=>".self::setArray($val); }else{ $return .= "'{$key}'=>'{$val}',"; } } $return = trim($return,','); $return .= ')'; return $return; } } $data = message::get(); //假设取出的数据 $data[] = array(1,2,3,4); //增加一条数据 message::put($data); //必须得是一次取出的数据,否则会将原来的覆盖写 ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use