Let's take a look at a simple js check for mobile phone access to carry out the mobile website code. I hope the article will be helpful to you. Here we just make a comprehensive judgment.
The Code is as follows:
Copy code
If (/AppleWebKit. * Mobile/I. test (navigator. userAgent) | (/MIDP | SymbianOS | NOKIA | SAMSUNG | LG | NEC | TCL | Alcatel | BIRD | DBTEL | Dopod | PHILIPS | HAIER | LENOVO | MOT-| Nokia | SonyEricsson | SIE -| Amoi | ZTE /. test (navigator. userAgent )
I. What does wipe mean?
The literal meaning of the English word is "yellow", "wipe", "dry", and "clean, from the professional perspective of Flash fans, it can be considered as an operation to erase mobile phone data. What does wipe mean? Professional answers: wipe restores factory settings, including deleting contacts, text messages, installed software, and so on. Recover factory settings. Note: The app2sd and root permissions must be re-executed after wipe. In addition, the important partition
The setcookie () function is a function in php used to set the cookie value. Next I will summarize the specific usage of the setcookie () function and how to obtain the cookie value after setting.
The setcookie () function sends an HTTP cookie to the client.
Cookie is a variable sent from the server to the browser. Cookies are usually small text files embedded into users' computers by servers. This cookie is sent every time a computer requests a page through a browser.
The cookie name is a varia
follows:
Copy code
$ Y = date ("Y", time ());$ M = date ("m", time ());$ D = date ("d", time ());$ Start_time = mktime (9, 0, 0, $ m, $ d, $ y );$ End_time = mktime (19, 0, 0, $ m, $ d, $ y );$ Time = time ();If ($ time >=$ start_time $ time {// Do something ....}?>
Next we will introduceTimestamp to date
Date () function,
This function not only obtains various time and date types, but also supports date conversion calling.
The Code is as follows:
Copy code
In php, the header function is used heavily. the header can not only send the original HTTP header information to the client, but also directly implement File Download operations, next we will introduce you to the editor.
The header function is most commonly used for sending http classes instead of downloading.
Jump
It will execute the last one, but it is conditional, for example:
The Code is as follows:
Copy code
Header ('location: http://www.bKjia.
I wrote a simple php curl encapsulation function that supports HTTPS three years ago. At that time, I only knew why. Now I will take a look at it in detail.
Https Server post Data
The Code is as follows:Function curlPost ($ url, $ data, $ timeout = 30){$ Ssl = substr ($ url, 0, 8) = "https ://"? TRUE: FALSE;$ Ch = curl_init ();$ Opt = array (CURLOPT_URL => $ url,CURLOPT_POST => 1,CURLOPT_HEADER => 0,CURLOPT_POSTFIELDS => (array) $ data,CURLOPT_RETURNTRANSFER => 1,CURLOPT_TIMEOUT => $ timeout,);I
Empty (), is_null (), isset () truth table (difference)
Let's take a look at the functional descriptions of these three functions www. bKjia. c0m
Isset determines whether a variable already exists. If the variable exists, TRUE is returned; otherwise, FALSE is returned.
Empty determines whether the variable is null. If the variable is not null or a non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var; an
In php, replace the characters at the specified position in the string with asterisks. Our function can be used to implement substr, preg_replace, substr_replace, and so on. Below we will introduce one instance for the three functions respectively, we mainly talk about the phone number and ID card.
Replace the phone number string with the asterisk code:
The Code is as follows:
Copy code
$ Str = "15832818835 ";Echo substr ($ str,). '*****'. substr ($ str, 8, strlen ($ str)
This image upload source code is a function that can upload images and generate thumbnails and add watermarks for uploaded images. It is a perfect Image Upload class.
Php tutorial Image Upload code (with the ability to generate thumbnails and add watermarks)This image upload source code is a function that can upload images and generate thumbnails and add watermarks for uploaded images. It is a perfect Image Upload class.
Class upfile {Public $ filepath = "www. bKjia.
Fopen is a very good function to collect remote server content and save it to a local location. It can also open local files, next let's take a look at the solution to the failed to open stream: HTTP request failed problem when using the fopen function.
$ Handle = fopen ("http://www.zhutiai.com/c5-03/", "rb ");$ Contents = "";While (! Feof ($ handle )){$ Contents. = fread ($ handle, 8192 );}Fclose ($ handle );Echo $ contents; // output the obtained content.?>
// The following code can be used
When programming PHP programs, we often encounter multi-level menu design programming. For example, for common third-level menus, we first display the first-level category of the product, and then display the second-level category, finally, the product is displayed, which constitutes a three-level structure. If there is no good category menu support in the background, it is very troublesome to change the data.
Recently, we have been working on a content management project, and customers have to
There are a lot of PHP code snippets on the Internet that can improve development efficiency. You can also learn the skills and apply them to your own projects. Below I love boiled fish and I will select several useful PHP snippets.
Extract keywords from webpages
Extract and display keywords from the specified page.
The Code is as follows:
Copy code
$ Meta = get_meta_tags ('HTTP: // www. bKjia. c0m /');$ Keywords = $ meta ['key
This article uses two examples to analyze and introduce the usage and format of the php date and mysql date, as well as the field types and query efficiency tests used when mysql uses the date.
Php
Int value:Time (): returns the number of seconds from the Unix epoch (GMT 00:00:00, January 1, January 1, 1970) to the current time.We can use strtotime () to obtain the number of seconds from January 1-20, 1970 to 2012: strtotime ('2017-2-10 ');Date value:
String date (string format [, int timestamp]
At present, the general space supports htaccess 301 redirection, but many friends do not know how to correctly implement htaccess 301 redirection. I will share with you a piece of correct code.
The Code is as follows:
Copy code
RewriteEngine onRewriteCond % {HTTP_HOST} ^ (bKjia. c0m) (: 80 )? [NC]RewriteRule ^ (. *) http://www.bKjia. c0m/$1 [R = 301, L]
There are many
Php multi-file upload code implementation php multi-file upload function this article uses php multi-File Upload class implementation, and provides an example of php multi-File Upload instance, multi-file Upload is the most important thing about file attributes, which must be in the form of arrays and read by foreach or for. Then, you can use move_uploaded_file to upload files to the server.
Php multi-file upload code for php multi-File UploadThis article uses php multi-File Upload class for i
We often see on the website that we can directly Save the website to our computer in a shortcut, and then click it to access the network, in php, how does one add a webpage to the desktop shortcut.
Simple functions and direct code.
The Code is as follows:
Copy code
Shortcuts. php code
The Code is as follows:
Copy code
$ Shortcut ="[InternetShortcut]URL = http://www.bKjia. c0mIDList = IconFile = http://www.bKjia.
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.