国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 php手冊(cè) 一個(gè)很簡(jiǎn)單的文本式留言板

一個(gè)很簡(jiǎn)單的文本式留言板

Jun 06, 2016 pm 07:32 PM
message board Simple Own

自己寫(xiě)了一個(gè)文本式留言板大神勿噴第一次發(fā)求過(guò)。。。 無(wú) ?php/*** 留言板類(lèi)* qq232025079@126.com* 2013/11/17*/class message{public static $file = './message.txt'; //文件地址/*** 寫(xiě)入** param array data 要保存的信息(可以是二維數(shù)組)*/public sta

自己寫(xiě)了一個(gè)文本式留言板?大神勿噴?第一次發(fā)?求過(guò)。。。
<?php
	/**
	* 留言板類(lèi)
	* qq232025079@126.com
	* 2013/11/17
	*/
	class message{

		public static $file = './message.txt';	 //文件地址
	
		/**
		*  寫(xiě)入
		*
		* param array data 要保存的信息(可以是二維數(shù)組)
		*/
		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;
		}
		/*
		* 將數(shù)組變成字符串形式
		*
		* 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();	//假設(shè)取出的數(shù)據(jù)
	$data[] = array(1,2,3,4);	//增加一條數(shù)據(jù)
	message::put($data);	//必須得是一次取出的數(shù)據(jù),否則會(huì)將原來(lái)的覆蓋寫(xiě)
?>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The easiest way to query the hard drive serial number The easiest way to query the hard drive serial number Feb 26, 2024 pm 02:24 PM

The hard disk serial number is an important identifier of the hard disk and is usually used to uniquely identify the hard disk and identify the hardware. In some cases, we may need to query the hard drive serial number, such as when installing an operating system, finding the correct device driver, or performing hard drive repairs. This article will introduce some simple methods to help you check the hard drive serial number. Method 1: Use Windows Command Prompt to open the command prompt. In Windows system, press Win+R keys, enter "cmd" and press Enter key to open the command

How to write a simple online reservation system through PHP How to write a simple online reservation system through PHP Sep 26, 2023 pm 09:55 PM

How to write a simple online reservation system through PHP. With the popularity of the Internet and users' pursuit of convenience, online reservation systems are becoming more and more popular. Whether it is a restaurant, hospital, beauty salon or other service industry, a simple online reservation system can improve efficiency and provide users with a better service experience. This article will introduce how to use PHP to write a simple online reservation system and provide specific code examples. Create database and tables First, we need to create a database to store reservation information. In MyS

MySQL Table Design Guide: Create a Simple Employee Attendance Sheet MySQL Table Design Guide: Create a Simple Employee Attendance Sheet Jul 01, 2023 pm 01:54 PM

MySQL Table Design Guide: Creating a Simple Employee Attendance Table In enterprise management, employee attendance management is a crucial task. In order to accurately record and count employee attendance, we can use the MySQL database to create a simple employee attendance sheet. This article will guide you how to design and create this table, and provide corresponding code examples. First, we need to identify the required fields for the employee attendance sheet. Generally speaking, employee attendance sheets need to contain at least the following fields: employee ID, date, working time, off-duty time

How to use PHP to develop simple file management functions How to use PHP to develop simple file management functions Sep 20, 2023 pm 01:09 PM

Introduction to how to use PHP to develop simple file management functions: File management functions are an essential part of many web applications. It allows users to upload, download, delete and display files, providing users with a convenient way to manage files. This article will introduce how to use PHP to develop a simple file management function and provide specific code examples. 1. Create a project First, we need to create a basic PHP project. Create the following file in the project directory: index.php: main page, used to display the upload table

How to write a simple student performance report generator using Java? How to write a simple student performance report generator using Java? Nov 03, 2023 pm 02:57 PM

How to write a simple student performance report generator using Java? Student Performance Report Generator is a tool that helps teachers or educators quickly generate student performance reports. This article will introduce how to use Java to write a simple student performance report generator. First, we need to define the student object and student grade object. The student object contains basic information such as the student's name and student number, while the student score object contains information such as the student's subject scores and average grade. The following is the definition of a simple student object: public

How to write a simple minesweeper game in C++? How to write a simple minesweeper game in C++? Nov 02, 2023 am 11:24 AM

How to write a simple minesweeper game in C++? Minesweeper is a classic puzzle game that requires players to reveal all the blocks according to the known layout of the minefield without stepping on the mines. In this article, we will introduce how to write a simple minesweeper game using C++. First, we need to define a two-dimensional array to represent the map of the Minesweeper game. Each element in the array can be a structure used to store the status of the block, such as whether it is revealed, whether there are mines, etc. In addition, we also need to define

How to write a simple music recommendation system in C++? How to write a simple music recommendation system in C++? Nov 03, 2023 pm 06:45 PM

How to write a simple music recommendation system in C++? Introduction: Music recommendation system is a research hotspot in modern information technology. It can recommend songs to users based on their music preferences and behavioral habits. This article will introduce how to use C++ to write a simple music recommendation system. 1. Collect user data First, we need to collect user music preference data. Users' preferences for different types of music can be obtained through online surveys, questionnaires, etc. Save data in a text file or database

How to write a simple web crawler using PHP How to write a simple web crawler using PHP Jun 14, 2023 am 08:21 AM

A web crawler is an automated program that automatically visits websites and crawls information from them. This technology is becoming more and more common in today's Internet world and is widely used in data mining, search engines, social media analysis and other fields. If you want to learn how to write a simple web crawler using PHP, this article will provide you with basic guidance and advice. First, you need to understand some basic concepts and techniques. Crawling target Before writing a crawler, you need to select a crawling target. This can be a specific website, a specific web page, or the entire Internet

See all articles