Example of using file cache in php
In web development, you can use file caching to greatly relieve the pressure on the database. The following code is an example of using file caching in php. CacheLayer. php
Class
Php converts a color to a deeper color function.
This php function can make the specified color deeper.
Function ColorDarken ($ color, $ dif = 20 ){
$ Color = str_replace ('#', '', $ color );
If (strlen ($ color )
PHP: how to obtain letters on the Chinese homepage
Function getfirstchar ($ s0 ){
$ Fchar = ord (substr ($ s0, 0, 1 ));
If ($ fchar> = ord ("a") and $ fchar = ord ("") and $ fchar
$ S = iconv ("UTF-8", "gb2312", $
Php code for processing file downloads
Php code provided for download on the server. you can specify the file name to be downloaded and the file content to be dynamically specified.
// Local file that shocould be sent to the
Use php to generate the card number and password
/*
1. Generate a random number
2. insert a table
3. query
4. yes is returned.
*/
Function mak () // The algorithm for generating the card
Ultra-lightweight open-source PHP Framework: FatFreeFramework
A powerful and easy-to-use PHP microarchitecture is designed to help you build dynamic and powerful Web applications-fast!The size of the entire framework is less than 60 kB.
PHP code for retrieving memory usage information
With this php code, you can know the usage of RAM (memory) on your server.
Echo "Initial:". memory_get_usage (). "bytes \ n ";
/* Prints
Initialize: 361400 bytes
*/
Code for generating CSV files from a PHP array
The following code generates a CSV file from the PHP array.
Function generateCsv ($ data, $ delimiter = ',', $ enclosure = '"'){
$ Handle = fopen ('php: // temp ', 'R + ');
Upload images and use ImageMagick to generate thumbnails
With ImageMagick, you can easily and quickly create thumbnails, which is much easier than using PHP.
// Location to upload main image:
$ MainDir = $ _ SERVER
Traditional and Simplified PHP functions
Class utf8_chinese
{
Private $ utf8_gb2312;
Private $ utf8_big5;
Private $ data;
Public function _ construct ($ data ){
$ This-> utf8_gb2312 = $ data ['
Php code for backing up mysql data
#####################
// Deployments
#####################
// Define the name of the backup directory
Define ('backup _ dir', './mybackups ');
// Define
Youcai open course notes: php design mode (1) singleton mode
I recently launched three open courses on design patterns. now I will summarize the application of the design patterns in PHP. this is the first Singleton mode of creation
The function of the IP address of the other party is automatically blocked when CC or DDOS attacks occur.
This function is used to count the total number of visits per visitor in a short period of time. if the limit is exceeded, TRUE is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service