There are various types of codes commonly used in development, such as uft8-> gbk to utf8 traditional to simplified to traditional utf8 to unicode gbk to pinyin Ascii to pinyin, etc./*** Utf8 to gbk* @ Param $ utfstr*/Function utf8_to_gbk ($ utfstr )
1, Mime_content_type () function to judge get file type
Mime_content_type returns the MIME type of the specified file.
Usage:
The code is as follows
Copy Code
Echomime_content_type (' Php.gif '). " n ";Echomime_content_
I remember reading an article a long time ago, saying how to write code can make your code more beautiful. I saw some comments about code beautification on the Forum a few days ago, so I also wrote something ......
A good programmer is not only
In linux, OpenGL reads JPG, PNG, TAG texture data, and opengltag
The code for actually reading images has been uploaded to my resources. The following is an example (the code is not rigorous and can be taken together ):
Unsigned char * esLoadJPG
Detecting file types
function Checkfiletype ($fileName) {
$file = fopen ($fileName, "RB");
$bin = Fread ($file, 2); Read-only 2 bytes
Fclose ($file);
c is an unsigned integer, the net search is C, signed integer, this will
Php code for file type detection based on file header information
// Check the file type
Function checkFileType ($ fileName ){
$ File = fopen ($ fileName, "rb ");
$ Bin = fread ($ file, 2); //
File signatures are usually in the header of the file, and if you view the file in hexadecimal, you can see some signature information for the file. If you use Uestudio to view a zip-formatted file in 16, the file content header has 4 b 03 04 hex
The code that actually reads the picture has already been uploaded into my resources, and the following example is posted:unsigned char* esloadjpg (const char *filename, int *width, int *height, int *size){FILE *f = fopen (FileName, "RB");Fseek (f, 0
This example describes how PHP determines whether a GIF picture is a dynamic picture. Share to everyone for your reference. The specific methods are as follows:
How to use PHP to determine whether a GIF picture is a dynamic picture (animation)? The
Determine whether a file is a text file or a binary file can help the compression software for different files to select the corresponding algorithm, then how to determine whether a file is text or binary it.
Older versions of PKZIP are used in the
FunctioncheckFileType ($ fileName) {$ filefopen ($ fileName, rb); $ binfread ($ file, 2); read-only 2 bytes fclose ($ file); $ strInfo @ unpack (C2chars, $ bin); C is an unsigned integer, and all found online are c, which is a signed integer, which
File signatures are generally in the file header. If you view the file in hexadecimal mode, you can see some signature information of the file. For example, if you use uestudio to view ZIP files in hexadecimal format, the file content header
Editor's note: gradually, a man who is a programmer and adds a house man has gone from being no longer interested in third-dimensional things to the realm of happiness only when he watches 16-color pictures. In order to have more pictures to see, a
How PHP determines if a GIF image is a dynamic image
Example
The code is as follows
/** Determine if the picture is a dynamic picture (animation)*/function Isanimatedgif ($filename) {$FP =fopen ($filename, ' RB
PHP to determine whether a GIF image is a dynamic image method,
This example describes how PHP determines whether a GIF image is a dynamic image. Share to everyone for your reference. Here's how:
How to use PHP to determine whether a GIF picture is
IP geolocation Query class
/**
File name: IpLocation.class.php
* IP Geo-Location query class (Master file I'm uploading it.) I upload a test file, and there is a QQWry.Dat this can be downloaded to the pure IP
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.