Programming rookie to learn PHP bottom operating mechanism and principles to pay attention to what?

What the class has to share with you today is how to learn the underlying workings and principles of PHP, a dynamic language for web development. Specifically, it is a software framework that implements a large number of components in the C language.

PHP file read/write

$handle = @ fopen ("Demo.txt", "R"); if ($handle) { while ($buffer = Fgets ($handle, 4096))!== false) { Echo $buffer; } if (! feof ($handle)) { echo "error:unexpected fgets () fail\n"; } Fclose

PHP gets all the links in a page

By using this code snippet, you can easily extract all the links on any Web page. $html = file_get_contents (' http://www.example.com '); $dom = new DOMDocument (); @ $dom->loadhtml ($html); Grab all the

PHP array to generate CSV file

A very simple function to generate a. csv file from a PHP array. This function uses the Fputcsv PHP built-in function to generate a comma-delimited file (. CSV). The function has 3 parameters: data, delimiters, and CSV enclosure, which are double

PHP is based on a given latitude and longitude point, the location of the nearby query

The implementation principle first calculates the four points of the rectangle around the point, and then uses latitude and longitude to directly match the records in the database. Get surrounding coordinates Public Function

PHP generates graphics verification code (mixed uppercase and lowercase letters and numbers)

Header ("Content-type:image/png"); $num = $_get[' num ']; $imagewidth = 60; $imageheight = 18; Srand (Microtime () * 100000); $numimage = Imagecreate ($imagewidth, $imageheight); Imagecolorallocate ($numimage, 183,

PHP Records access times with cookies

$f _open = fopen ("Count.txt", "r+"); Opens the specified file $count = fgets ($f _open); Reading data from a file if (Empty ($_cookie[' cookie_name ')) {//To determine if a COOKIE exists Setcookie ("Cookie_name", Value,time () +180

PHP code that prints data as a picture

$query = "SELECT count (IP) as count_ip from tb_count04"; Querying the total number of IP accesses in the database $result =mysql_query ($query); $countes =mysql_result ($result, 0, ' count_ip '); Creating a canvas

PHP version arbitrary binary conversion

$int = 36; $str =array (); $flag = 0; Echo chr ($int%36+87); while ($int!=0) { if ($int%36 else $str [$flag ++]=chr ($int%36+87); $int/=36; } for ($i = $flag; $i >=0; $i-=1) if ($str [$i]!=0

PHP Implementation parse Web page and download image to local

error_reporting (0);//Close error Report Include_once ("simple_html_dom.php");//introduction of analytic libraries $url = ' http://www.w3cschool.cc/mongodb/mongodb-window-install.html '; $html =file_get_html ($url); while

PHP Implementation point card number password generation

/* 1. Generate Random Numbers 2. Inserting a table 3. Enquiry 4. Return Yes */ function mak ()//Generate card number cipher algorithm can be replaced; { $str =md5 (Microtime ()); $pass =substr ($STR,-12);

PHP Processing checkbox check box form submission

The PHP form submits the page check box after the name to add [], so that the receiving page to get the correct results. The form is submitted with an array, and then the specific Vaule value of the form is obtained by accessing the array elements.

PHP implements the function of compressing HTML

function compress_html ($string) { $string = Str_replace ("\ r \ n", ", $string); Clear line break $string = Str_replace ("\ n", "", $string); Clear line break $string = Str_replace ("\ T", "', $string); Clear tabs $pattern =

PHP implementation to get the Chinese first letter method

function Getfirstchar ($s 0) { $fchar = Ord (substr ($s 0, 0, 1)); if ($fchar >= ord ("a") and $fchar = ord ("a") and $fchar $s = Iconv ("UTF-8", "gb2312", $s 0); $ASC = Ord ($s {0}) * n + ord ($s Beckham)-65536; if ($asc >=

A general method of PHP for data paging

function Show_page ($count, $page, $page _size) { $page _count = ceil ($count/$page _size); Calculate the total number of pages $init = 1; $page _len=7; $max _p= $page _count; $pages = $page _count; Judging the

PHP File Upload Example

Handling code: Header (' Content-type:text/html;charset=utf-8 '); Ready to receive /* echo ' filename: '. $_files[' userfile ' [' name ']; echo ' File size: '. $_files[' userfile ' [' Size ']; Echo ' ERROR:

PHP code for non-deforming screenshots

function My_image_resize ($src _file, $dst _file, $new _width, $new _height) { $src _img=imagecreatefromjpeg ($src _file); $w =imagesx ($src _img); $h =imagesy ($src _img); $ratio _w=1.0 * $new _width/$w; $ratio _h=1.0 *

PHP randomly generates easy-to-remember passwords

function random_readable_pwd ($length =10) { The wordlist from which the password gets generated (change them as) $words = ' Dog,cat,sheep,sun,sky,red,ball,happy,ice, '; $words. = ' Green,blue,music,movies,radio,green,turbo,

Scheduled (scheduled) tasks implemented by PHP

Sometimes in order to adjust the interface periodically, the program needs to run automatically. There are two ways to do this from the Internet: 1, Ignore_user_abort () Ignore_user_abort () functions with Set_time_limit (0) and sleep ($interval)

PHP Random Color generator

function Randomcolor () { $str = ' # '; for ($i = 0; $i $randNum = rand (0, 15); Switch ($randNum) { Case: $randNum = ' A '; Break Case one: $randNum = ' B '; Break Case: $randNum = ' C '; Break Case:

Total Pages: 5208 1 .... 4819 4820 4821 4822 4823 .... 5208 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.