PHP code used to determine whether a device is a mobile phone tablet
Page matching for mobile devices is often required during web development. of course, you can directly make the website responsive, but if you don't want to do this, you
Verify the validity of the ID card in PHP.
/**
* ID card
*
* @ Param string $ id
* @ Return boolean
*/
Function is_idcard ($ id)
{
$ Id = strtoupper ($ id );
$ Regx = "/(^ \ d {15} $) |
A simple PHP class for a socket client
Php 5. You need to enable socket extension
// Socke operation class
Class Socket {
Private $ host; // host connected to the socket
Private $ port; // the port number of the
PHP mail operations
Class smtp
{
Var $ smtp_port;
Var $ time_out;
Var $ host_name;
Var $ log_file;
Var $ relay_host;
Var $ debug;
Var $ auth;
Var $ user;
Var $ pass;
PHP sensitive word filtering code
$ F = file('words.txt ');
$ Words = array ();
Foreach ($ f as $ w ){
$ Words [] = preg_quote (trim ($ w ),'/');
}
$ Text = file_get_contents('text.txt ');
$
PHP downloads and collects remote images to a local device
/**
* Download a remote image to a local device.
*
* @ Param string $ url remote file address
* @ Param string $ filename name of the saved file (if
PHP a simple and quick sorting
Fast sorting by constantly locating the location of the benchmark number
/**
* Created by PhpStorm.
* User: saint
* Date: 15/8/5
* Time: AM
*/
Class Demo
{
PHP adds subtitle display to the video through ffmpeg
$ Dir = './'; // set to current folder
If ($ handle = opendir ($ dir )){
While (false! ==( $ File = readdir ($ handle ))){
If (is_file ($ dir. $ file )){
PHP obtains the real IP address of a user.
Function getRealIpAddr ()
{
If (! Emptyempty ($ _ SERVER ['http _ CLIENT_IP '])
{
$ Ip = $ _ SERVER ['http _ CLIENT_IP '];
}
Elseif (! Emptyempty ($ _
PHP extracts the main color of any image
Function dominant_color ($ image)
{
$ I = imagecreatefromjpeg ($ image );
For ($ x = 0; $ x
For ($ y = 0; $ y
$ Rgb = imagecolorat ($ I, $ x,
PHP formatting time, several minutes ago, several hours ago
// Formatting time, several minutes ago, several hours ago
Function format_date ($ time ){
$ T = time ()-$ time;
$ F = array (
'20140901' => '
Implemented php class that supports resumable download of files
The example in this article describes the php-enabled resumable object download class and its usage. it is a very practical technique. Share it with you for your reference. The
Returns the regular expression of a number in a string.
$ Patterns = "/\ d +/"; // The first
// $ Patterns = "/\ d/"; // second
$ Strs = "left: 0px; top: 202px; width: 90px; height: 30px ";
Preg_match_all ($
PHP time processing functions
// Mktime ()
Convert date and time to unix timestamp
// Time ()
Obtains the unix timestamp of the current time.
Echo date ("Y-m-d", mktime ))."";
//
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