PHP and JS to determine the routing to the specified page

PHP jumps according to Referer: The code is as follows Copy Code $ref = $_server[' Http_referer '];if (Stripos ($ref, "Baidu") | | stripos ($REF, "Google"){Header ("Location:http://www.111cn.net");Exit}?> Jump

2 methods for merging two-dimensional PHP arrays

Example 1 Custom Methods Merge Arrays First look at a two-dimensional array: The code is as follows Copy Code Array ( [0] => Array ( [A] => store_name [B] => Store A ) [1] => Array ( [A] => Store_owner [B] => small

Several methods for random ordering of PHP arrays

You can use the shuffle function in PHP to implement the array random sorting function. The code is as follows Copy Code $test =array (); $test []=array (         ' title ' => ' Q1.) What is the more scientific

Conversion of PHP variables to arrays (extract and compact)

Compact multiple variable Array The code is as follows Copy Code Multiple variable array$name = ' Phpff ';$email = ' phpff@phpff.com ';$info =compact (' name ', ' email ');//Pass variable namePrint_r

PHP connection MSSQL Configuration tutorial

Configure php1. Open php. in and remove the annotation symbol of extension = php_mssql.dll.2. Open php. in and change mssql. secure_connection = Off to on.3. Copy php_mssql.dll to the directory specified by extension_dir in php. in or the system32

Php + SqlServer implement paging display

Lt; html> $ Id = @ mssql_connect ("ddy", "sa", "") or die ("unable to connect ");$ Db = mssql_select_db ("ddy", $ id );$ Query = "select * from lr00 order by lr0012 desc ";$ Result = mssql_query ($ query );If ($ result ):If ($ tt = ""){$ Nopa = 0 ;}

Php uses Google API to obtain the current weather information code

The code is as follows:Copy code $ Xml = simplexml_load_file ('http: // www.google.com/ig/api? Weather = Changsha ');$ Information = $ xml-> xpath ("/xml_api_reply/weather/current_conditions/condition ");Echo $ information [0]-> attributes ();?>

Code for json format data conversion in php

Step 1: Use the json_encode () function to convert data to json data. The code is as follows:Copy code // JSON format data is represented by arrays in php.$ Arr = array ('Firstname' => iconv ('gb2312', 'utf-8', 'sincerity '),'Lastname' => iconv (

Three functions of date and time comparison in php

The date comparison is shown in 2011-11-11 2011-12-12. The code is as follows:Copy code Function compare_date ($ DATE1, $ DATE2){ $ STR = strtok ($ DATE1 ,"-");$ YEAR1 = $ STR;$ STR = strtok ("-");$ MON1 = $ STR;$ STR = strtok ("-");$ DAY1 = $

Php code for converting numbers into currency formats

The code is as follows:Copy code Function format_money ($ STR){ If ($ STR = "")        { Return "";        } If ($ STR = ". 00 ")        { Return "0.00 ";        } $ TOK = strtok ($ STR ,".");If (strcmp ($ STR, $ TOK) = "0 ")        { $ STR. = ".

Php fund format conversion function

The code is as follows:Copy code  // Function name: ExchangeMoney ($ N_money)// For use: capital conversion function// Parameter: $ N_money (number of the amount to be converted)// Return value: string// Standby note: This function example: $

Disordered order of numbers and associated arrays in php

The solution is as follows: join array and index array can be used The code is as follows:Copy code Function array_shuffle ($ array){// Not an arrayIf (! Is_array ($ array )){Return array ();    }// If it is null or there is only one itemIf ($

Php date addition and subtraction operation implementation code

Example: obtain the date of the previous day from January 1,. The code is as follows:Copy code // Convert a time point to a timestamp$ Date = strtotime ('2017-5-1 ');// Output the date before the day, minus the number of seconds of the day in

Usage of chr (ascii) and ord (string) functions in php

First LookChr functionThe chr () function returns characters from the specified ASCII value.Chr (ascii)Ascii parameters can be decimal, octal, or hexadecimal. You can specify the octal ratio by using the frontend 0 and the hexadecimal value by using

Paging code is required for php development

The code is as follows:Copy code /*** Paging functions* * @ Param int $ count total number of entries* @ Param int $ perlogs number of entries displayed per page* @ Param int $ page current page number* @ Param string $ url address of the page

Php 2D array sorting code

The code is as follows:Copy code  $ Ar = array (0 => array ('a' => 5, 'B' => 3, 'C' => 3 ),1 => array ('a' => 5, 'B' => 2, 'C' => 1 ),2 => array ('a' => 1, 'B' => 1, 'C' => 2));$ A = array ();$ B = array ();  Foreach ($ ar as $ k => $ v ){$ A [$

Php obtains the playing time of a music file.

The code is as follows:Copy code $ File = "C:/Users/Public/Music/Sample Music/kalimbaloud "; If (! File_exists ($ file )){Exit ('media file does not exist .');} // Create a Windows Media Player interface$ Player = new COM ("WMPlayer. OCX ");$

Php random password generation program

Randomly generated password: m1ztpxw8  The code is as follows:Copy code Function genPwd ($ length = 6 ){$ Password = '';$ Possible = '23456789bcdfghjkmnpqrstvwxyz ';$ I = 0;While ($ I  $ Password. = substr ($ possible, mt_rand (0, strlen ($

Php computing posts a few minutes ago

The code is as follows:Copy code Function tranTime ($ time ){$ Rtime = date ("m-d H: I", $ time );$ Htime = date ("H: I", $ time );     $ Time = time ()-$ time; If ($ time $ Str = 'gang ';    } Elseif ($ time $ Min = floor ($ time/60 );$ Str = $

Total Pages: 12780 1 .... 9399 9400 9401 9402 9403 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.