Essay classification-Php+mysql Encapsulation and Inheritance (PHP learning) Summary: What is encapsulation? A: The package does not know the internal structure, the external only shows the function of this behavior. For example: Radio, you do not know the structure of the radio, but you know the radio can be used to listen to the radio. In PHP, encapsulation is, not externally disclosed, properties and methods, these properties and methods, which are not directly accessible from outside the class, but provide an excuse to access these properties and methods through this pretext. PHP through the permission control to achieve encapsulation, there is public, protected, private these three kinds of public whether it is within the class or outside the class can directly access the protected and private only through the class access inheritance: Subsets inherit the properties and methods of the parent set, for example, The student inherits the human through the extends to inherit reads the full text
Posted @ 2013-09-08-Leo Column read (22) | Comments (0) Edit
Declaration and instantiation of classes and methods for constructing methods (PHP Learning) Summary: Leo [age] + 25) *///Why is there no leg? Because of the addition of static, it becomes the property of the class, is all///Through this class instance instance of the object after the//public is the permission modifier, the permission modifier has public,protected,private//in PHP4 often used to Var, This is not how to recommend now, it is equivalent to public//in the PHP5 will be the VAR analysis to public?> there is no way in the new object, by passing parameters to change the properties of the object? Instead of a uniform answer: You can define a construction method in a class, that is, when the object is initialized, it executes, and you can receive the parameters as follows: Name= $name; $this->age=$ Read the full text
Posted @ 2013-08-29 22:16 Leo Column read (35) | Comments (0) Edit
Designing a Web Database (learning) Summary: Designing a Web Database 1. Consider modeling the actual object for real-world entities and relationships to build a model in the case of the above-mentioned table? A: If you have a group of data that is of the same type, you can create a table 2 based on that data. Avoid saving redundant data reasons: A. Waste of space, obviously only need to save once, the foreign key call can be, but the actual input several times B. Result in inconsistent data updates, irregular changes, more changes, irregular entry, deletion of irregular, such as the order address, after deletion, to call the need to re-entry 3. Use atomic column values for each row The column stores only one data 4. Select a meaningful key 5. Consider the need to ask the database for the design of the database to answer the questions we care about 6. Avoid multiple empty attribute designs A. Add one more column, there may be empty data bad place is 1. Wasted Space 2. When the user sees, use ... Read the full text
Posted @ 2013-08-28 23:43 Leo Column read (13) | Comments (0) Edit
Object-oriented (PHP learning) Summary: In the development of ultra-large projects, if the use of process-oriented development, the code is very large, which will be used in a large number of judgment and loop nesting, and many very similar code, not only make the project code volume is more large, but also not conducive to the development, reuse and maintenance. Object-oriented can be a good solution to this problem, object-oriented very good encapsulation, save a lot of energy, do not care about the inner workings of objects, as long as the interaction between objects and objects, easy to maintain, and inheritance makes the code a lot of streamlining. Let's take a look at a topic: Zhang San is an ordinary person, others greet him in the morning, he will say "Good morning", but one day he was hit by a car, his brain was a little hurt, so when others greeted him in the morning, he sometimes said: "Morning", but sometimes said: "Nice evening", and even insult each other. Analysis: Because we want to object-oriented now, let's take the object out first. Read the full text
Posted @ 2013-08-22 23:45 Leo Column read (20) | Comments (0) Edit
MySQL Learning (a) Abstract: 1.mysql series functions are process-oriented 2.MYSQLI series functions, is object-oriented 3.PDO is more powerful package (do not care what is behind the database, PDO has been processed, can connect Oracle) What is a server? A: The machine that provides the service, physically, is a service to provide the actual machine in the broad sense, for example, Apache provides 80 port, to the Web program use, then it is the Web server MySQL provides 3306 port, provides the data operation, then is the database server to connect the database, The first connection mysql_connect () function is to establish a connection, first Apiresource mysql_connect (string $server [, String $use ... Read the full text
Posted @ 2013-08-21 23:45 Leo Column read (16) | Comments (0) Edit
The usage of each and list (PHP learning) Summary: 1.each usage First look at the Apiarray each (array & $array) API is described in this way: each- Returns the current key/value pair in the array and moves the array pointer forward one step ahead, let's see what the returned array looks like. */* Returns an array ([1] = = You [value] = you [0] = 0 [key] + 0) Array ([1] = = if [value] = [0] = 1 [key] =& Gt 1) *///executes the same piece of code, from ' You ' to ' if ', stating that each is executed once, the cursor moves to the end of the array//0 and key are stored as keys//1 read the full text
Posted @ 2013-08-19 23:30 Leo Column read (807) | Comments (1) Edit
Array cursors implement various operations on arrays (PHP Learning) Summary: How do I use a foreach to implement a loop on an array? A: We just need to simulate foreach, and when the array executes the Foreach loop, there is a cursor that points to the value that the current array loops to. So if we can get this cursor and manipulate the cursor to move the cursor forward or backward, then we can implement the loop array directly on the code without the foreach, clear and Intuitive: ';} /* Return to you if it is sunny *///so how to make the cursor 2 Step 2 step? for (; $v =current ($arr);) {echo $v, '; next ($arr); next ($arr);} Execution results, no response, what is this for? The reason is that the previous loop cursor has reached the end of the array.//Therefore, when you read the full text
Posted @ 2013-08-19 22:22 Leo Column read (254) | Comments (0) Edit
foreach (PHP Learning) Summary: First look at an example: $arr = Array (0,1,2,3,4), so that each value of the array becomes twice times the original, how should be implemented? If you do not learn foreach before, you will think of a for loop 0 [1] = 2 [2] = 4 [3] = 6 [4] + 8) */?> This solution is that the key is the number, and is continuous, it can be used if the key is a string, and What should we do? For example: $arr = Array (' First ' =>0, ' second ' =>1, ' third ' =>2, ' IV ' =>3, ' V ' =>4); Let him read the full text
Posted @ 2013-08-18 11:32 Leo Column read (29) | Comments (0) Edit
Array Arrays (PHP learning) Summary: What is an array? A: It's a group of numbers. Array creation: ' Zhang San ', ' height ' = ' 174 ', ' home ' = ' Shanghai ',;p rint_r ($ARR);/* Method One: Set the key-value pair by using the array method to return an array ([name] = Zhang San [height] = 174 [Home ] = Shanghai) */unset ($ARR);//release $arr$arr[' name ']= ' Zhang San '; $Arr [' Height ']= ' 174 ';p rint_r ($ARR); /* Method Two: Read the full text with a value corresponding to a key
Posted @ 2013-08-18 10:44 Leo Column read (181) | Comments (0) Edit
File_put_contents and file_get_contents usage and problems encountered during use (PHP learning) Summary: The operation of the data is the most basic is the deletion and modification, file_put_contents and file_get_ Contents is the deposit and withdrawal of the data in the file. First on the code: ';} else{Echo ' data deposit failed ', ';} Returned: The data is saved successfully//the original corresponding directory is not the file//now has this file//From here can be seen, if there is no such file//Call the File_put_contents method will automatically create such a file//and then put the data into the Echo file_get_contents (' 01.txt '), ';//return Hello world//read the full text in this file
Posted @ 2013-08-17 23:05 Leo Column read (1188) | Comments (0) Edit
Str_split Usage (PHP Learning) Summary: Str_split usage: First look at the PHP manual is how to say the array str_split (string $string [, int $split _length = 1]) Str_split returned by the is an array, the first parameter is the string type that represents the strings to be grouped, the second parameter is the init type, which is a number of characters to group, and if there is no second argument, the default is 1 characters to see a topic, how to turn 1234567890 into 1, 234,567,890? Directly on the code: ';//return 0987654321echo $str, '; Returns 1234567890 description Strrev function does not affect the original string $revarr read the full text
Posted @ 2013-08-17 11:19 Leo Column read (559) | Comments (0) Edit
SUBSTR Learning (PHP Learning) Summary: SUBSTR usage: First look at the PHP manual, which is said in the manual string substr (string $string, int $start [, int $length]) to perform the substr returned by the is a string, and then its first argument is the string to be truncated, the second argument is the init type String that represents the beginning of the string, and the third parameter is the init type for the length. First look at only the first and second parameters of the case '; Returns Llo World, when the second argument is positive, and there is no third argument when//indicates starting from the left position, intercept to the end of the string echo $str, '; return Hello World Description substr ... Read the full text
Posted @ 2013-08-17 10:41 Leo Column read (209) | Comments (0) Edit
String Length (PHP learning) Summary: 1. What are the methods for calculating string lengths? A: strlen () and Mb_strlen () 2. What's the difference between the two? A: The following code strlen ($STR) calculates the length of the byte, in the UTF8 the next Chinese character represents 3 characters, the figure is 11 in GB2312 and GBK is 2 characters, calculated is 9 mb_ Strlen () calculates the character length Mb_strlen ($str, [gbk| Gb2312|utf8]) Here "|" Yes or means that the second parameter of Mb_strlen () is the encoded form GBK or GB2312 or UTF8 to use the Mb_strlen () method to get php.ini inside Extension=php_mbstring.dll This read the full text
Posted @ 2013-08-15 23:01 Leo Column read (41) | Comments (0) Edit
String (b) (PHP) Summary: 1. What should be said in PHP for large pieces of text? A: Should be ' because AAA plus single quotation marks, so the code in the $age does not parse, will be output, this is the difference between Nowdoc and Heredoc way, just like the difference between single and double quotes read the full text
Posted @ 2013-08-15 20:15 Leo Column read (17) | Comments (0) Edit
String (PHP Learning) Summary: 1. What is a string? A: A string of characters (reference kebabs) 2. String definition A: Single quotation mark, double quotation mark, string containing single or double quotation marks (1. Double quotes are enclosed in single quotation marks 2. Single quotes Inside with double quotes 3. Escape 4. Character stitching) 3. What is the difference between a single and double quote definition string? A: 1. Escape the character of a different single quotation mark only know \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \f \$ \v 2. Variable parsing differs in a single-quoted string, the variable is parsed in a double-quoted string, and will be faster than double quotes, so it is recommended to use single quotes sometimes with double quotes, such as in the patchwork of SQL statements ... Read the full text
Posted @ 2013-08-14 21:21 Leo Column read (8) | Comments (0) Edit
$GLOBALS Super Global Variables (PHP Learning) Summary: 1. The $GLOBALS is an array with all the global Variables 2. $GLOBALS is a super global variable that can be manipulated directly inside the function by the global variable. (Seriously not recommended because of a violation of the encapsulation principle) 3. Manipulating global variables by $globals will change global variables directly, because $globals is a reference to read the full text of the value
Posted @ 2013-08-14 20:35 Leo Column read (28) | Comments (0) Edit
Original code, anti-code, complement abstract: a copied Map code network: (1) The original code representation method is a simple representation of the number of machines. The sign bit with 0 for a positive sign, with: to denote a minus, the value is generally expressed in binary form. With a number of x, the original code is denoted as [x] original. For example, x1= +1010110 x2= 11,001,010 of its original code: [X1] Original =[+1010110] Original =01010110 [X2] Original =[-1001010] The original =11001010 original code to indicate the number of the range and bits number. When using 8-bit binary to represent the decimal source, its representation range: The maximum value is 0.1111111, its truth is about (0.99) 10 The minimum value is 1.1111111, its truth is about (0.99) 10 when using 8-bit binary to represent the integer original code, its representation range:. Read more
Posted @ 2013-08-08 16:51 Leo Column read (12) | Comments (0) Edit
PHP Learning Notes (a) Summary: 1. Reference operator & $a = 5; $b = & $a; $a = 7; $a and $b is now both 7 with a unset ($a); resetting does not change the value of $b (7), but it can break a $ A and value 7 saved link in memory. 2. Execute operator ('). Direction quotes <?php$out = ' dir c: '; Echo ' <pre> '. $out. ' </pre> ';? >3. Controlling the number of digits after the decimal point js var a = 4.345677;var B = a.tofixed (2); 2 digits after the decimal point alert (b); $ A in PHP = 4.3 Read the full text
Posted @ 2012-12-24 17:05 Leo Column read (25) | Comments (0) Edit
php--notes (ii) Summary: 1. Static page: There is a background, do not go through the Server Processing dynamic page: No background, after the server processing 2.<?php?> is the server-side tag user is not visible <script></script > is the client tag, the user is seen 3. $a = 12 $ is a large ad-hoc variable flag 4.pHP, with HTML mixed <ul> <?php for ($i =0; $i <10; $i + +) {?> <li>echo $i +1;</li> <?php}? ></UL>5.MVC M------Model Data V------View Read full text
Posted @ 2012-11-26 20:41 Leo Column read (22) | Comments (0) Edit
Simple Sina Weibo summary: first put code sina.php<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Posted @ 2012-11-26 20:28 Leo Column read (19) | Comments (0) Edit
PHP---Note summary: 1.php in <?php .....? ...???????????????? > inside is equivalent to JS placed in <script></script> 2.acho "ABC"; is equivalent to document.write ("abc"); Strings can be unquoted 3. $a = 12 is equivalent to the Var a =12;4.+ number in JS there are addition and string connection 2 functions, in PHP only add function and string connection with "." No. 5. JS inside the "" with "." In PHP, the inherited class person{funct in the symbol 6.pHP, "with", reads the full text
Posted @ 2012-11-22 20:04 Leo Column read (36) | Comments (0) Edit
Essay Classification-Php+mysql turn