PHP Knowledge Points Summary

Source: Internet
Author: User
Summary of PHP knowledge points

?

PHP Knowledge Point Summary:

?

1. Get the data submitted by the client utility $_post[];

? ? $str =$_post[' name '];

2. Implement two arrays of intersection, and, difference function:

? ? Array_intersect ($array 1, $array 2); (Intersection function)

? ? Array_diff ($array 1, $array 2); (difference set function)

? ? Array_merge ($array 1, $array 2); (Set function)

3. Functions for outputting array elements:

?? $fruit =array ("Lemon", "orange", "banana");

? ? Print_r ($fruit);

The result is: Array ([0]=>lemon [1]=>orange [2]=>banana];

4. Array sorting:

?

"; Print_r ($array); Echo Implode ("-", $array); Sort ($array); echo "
After array sorting
"; foreach ($array as $key = + $val) {echo "array[". $key. "] = ". $val."
"; } ? >

?

? The output is:

?

Array sort before arrays ([0] + = ASP [1] + PHP [2] + JSP) array sorted after array[0]=asp array[1]=jsp array[2]=php

The red part, the keys and values in the PHP array

5. File read

? ? The EOF character, which the PHP program will use in a standard way to identify when to reach the end of the file, this standard is often called the end of the file, or the EOF character.

? ? The feof () function is used to determine whether the file is at the end of the position, and the fgets () function reads one line at a time, and the FSCANF () function provides a way to parse the file in the format specified, fseek (resource handle,int offset [, int whence]) function can be used to randomly extract file rows

6. Functions to obtain files, directories, and disk sizes

? ? The filesize (string filename) function is used to return the number of bytes of a file, but a file with a size greater than 2GB may experience unintended results, typically using sprintf ("%u", FileSize ($file)) to resolve

7. File Upload

? ? By using PHP's global array $_files, you can upload files from a client computer to a remote server

?

$_files["File" ["Name"]-the name of the uploaded file $_files["file" ["type"]-the type of the file being uploaded $_files["file" ["Size"]-the size of the uploaded file, in bytes $_files[" File "[" Tmp_name "]-the name of the temporary copy of the file stored on the server $_files[" file "[" Error "]-error code caused by file upload

? 8. Get the size of the picture

?

Array getimagesize (string $filename [, Array & $imageinfo])

?

?

?

?

?

9. Time (), date (),getdate()-Get Date/time information,

?

? The return value is

?

now:2005-03-30 Next week:2005-04-07

The 10.header () function sends the original HTTP header to the client. Note : Before sending the packet header, there can be no other output, otherwise it will be an error?

Prompts the user to save a generated PDF file (the content-disposition header is used to provide a recommended file name and to force the browser to display the Save dialog box):

11. Several common functions of database operations

? ? mysql_connect ("localhost", "root", "root");

? ? mysql_fetch_object? -? get a row from the result set as an object

? ? mysql_query ("Set names ' GBK '");

?

?

12.php multiple parameter pass & connection, eg:

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

getimagesize ()?function will determine any?GIF,JPG,PNG,SWF,SWC,PSD,TIFF,BMP,IFF,JP2,JPX,JB2,JPC,XBM?or?WBMP?the size of the image file and returns the size of the image and the file type and one that can be used for normal?HTML?in the file?IMG?the Height/width text string in the tag.

If you cannot access?filename?the specified image, or it is not a valid image,getimagesize ()?will return?FALSE?and produce a?E_WARNING?level of error

?

Returns an array with four cells. Index 0 contains the pixel value of the image width, and index 1 contains the pixel value of the image height. Index 2 is a marker of the image type: 1 = gif,2 = jpg,3 = png,4 = swf,5 = psd,6 = bmp,7 = TIFF (Intel byte order), 8 = TIFF (Motorola byte order), 9 = jpc,10 = jp2,11 = jpx,12 = jb2,13 = swc,14 = iff,15 = wbmp,16 = XBM. These tags correspond to the newly added IMAGETYPE constants of PHP 4.3.0. Index 3 is a text string with the content "height=" yyy "width=" xxx ", which can be used directly with the IMG tag.

  • 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.