Sina Le Ju
One
1, there are the following html:
1 using JS to obtain ________ method to obtain the object;
2 The attribute value of attribute title is obtained by ________ attribute;
3) Using ________ method to obtain attribute value of attribute sina_title;
(1) document.getElementById (' img1′);
(2) document.getElementById (' img1′). getattribute (' title ');
(3) document.getElementById (' img1′). getattribute (' Sina_title ');
2, PHP in the array of serialization and deserialization functions are ___ and _____;
Serialize,upserialize
3, the difference between Rawurlencode and UrlEncode function is __________________;
Rawurlencode will convert the space to +,urlencode to convert the space to%20
4, PHP filter the HTML function is ___, the escape function is ____________;
Strip_tags,htmlspecialchars
5, write out with a regular HTML in the JS script filter out;
Preg_replace ('/<script.*?//script>/is ', ", $htmlcode);
6, the meaning of the left join in SQL is ______________;
If you have a table Tl_user store student IDs and name names, another table Tl_score store student IDs, subject subject, and results score (some students do not have test scores), write out the SQL statement to print out the student name and the general score;
Left JOIN, first remove all the data from the left table and then take out the right table data that satisfies the where condition. Returns NULL when the row's data does not meet the Where condition.
Select Tu.name,sum (Ts.score) as Totalscore from Tl.user left join Tl_score on tl.uid = Ts.uid;
7. Write out three functions that call system commands;
System,passthru,exec
8, the JOSN processing array function is;
Json_encode,json_decode
9, PHP to determine whether the variable is set is the function is ___, judge whether the empty is ___________;
Isset,empty
10, error_reporting ("E_all") and Ini_set ("Display_errors", "on") the difference _________;
The former is to set the error display level, and E_all represents all errors (including notice,warnning and error). The latter is set to let PHP display errors, in the case of error display control, the latter has the highest priority.
11, PHP to write out the client IP to show the predefined variable ________, provide the routing URL is __________;
$_server[' remote_addr '],$_server[' http_referer ']
12, PHP to convert Utf-8 to GBK function is ___________;
Iconv (' utf-8′, ' GBK ', $str);
13, PHP split string number of functions __________, the connection numbers composed of the string is ___;
Explode,implode
14, PHP class static method how to use _____________________________________;
Outside the class, use: The class name followed by a double colon, followed by the method name, similar to Classname::staticfucntion (), because the static method is not part of an object, but is subordinate to the entire class, so call it with the class name.
Two
1, the following error: MySQL server not go away, the reason is what. (presumably this is the case)
It should be MySQL has gone away, right?
In general, because the value of the Max_allowed_packet set is too small, max_allowed_packet is used to control the packet size of the buffer, sometimes when the data is imported, this value is too small to cause buffer capacity is not enough. Set this value in My.ini or my.cnf to a larger number to resolve.
Another possibility is to connect to the database using the single case mode, multiple operations of the database but all using the same connection, because the MySQL processing each thread is also the queue mode, the current operation is not completed and the interval is less than the value set by Wait_timeout, this problem occurs. The workaround is to set the value of the wait_timeout larger.
2, the static table of MySQL and dynamic table difference, MyISAM and InnoDB difference.
A static table is a static table when the variable-length field is not varchar,blob,text in a table, whereas if there is at least one variable-length field in a table, or if a table is created with the row_format=dynamic option, this table is a dynamic table.
The difference between MyISAM and InnoDB is that MyISAM does not support transaction processing because it does not have to commit, so it can operate faster than InnoDB. InnoDB is better than MyISAM in terms of security, because it supports transaction processing, Insert,update,delete,select. When the default autocommit=0 is used, each operation is treated as a transaction and can be rollback. If autocommit=1, it will automatically commit the transaction after each operation, resulting in slow execution, probably 10 times times slower than MyISAM.
3, $a = 1; $b = & $a;
unset ($a), $b is still 1, why.
Unset ($b), $a is still 1, why.
is equal to 1.
In PHP, the reference assignment is different from the memory of the pointer, and he simply points another variable name to one of the address. In this question: $b = & $a; The $b name also points to the memory address to which the $a variable is pointing. Unset only releases the point of the name, and does not release the value in memory. On the other hand, unset ($a), in fact, does not really immediately release the value in memory, but also only to release the name of the point, the function only when the value of the variable occupies more than 256 bytes long time to release the memory, The address is released only if all variables pointing to the value (for example, if the reference variable points to that value) are destroyed.
Three
1, write at least three functions, take the filename suffix, such as file '/as/image/bc.jpg ', get jpg or. jpg.
function MyGetExtName1 ($path) {
Remove the last occurrence. Index position of this character
$begin = Strrpos ($path, '. ');
Take out the entire string length
$end = strlen ($path);
The result returned after intercepting the total length of the string from the location of the last. Index.
Return $begin substr ($path, $begin, $end): ' The file does not have an extension ';
}
function MyGetExtName2 ($path) {
Return Preg_match_all ('//.[ ^/.] +/is ', $path, $m)? $m [0][count ($m [0])-1]: ' The file does not have an extension ';
}
function MyGetExtName3 ($path) {
Find the last occurrence. The index position of the character and return all the characters following it
Return STRRCHR ($path, '. ')? STRRCHR ($path, '. '): ' The file does not have an extension ';
}
2, write a function, calculate the relative path of two files such as $a = '/a/b/c/d/e.php '; $b = '/a/b/12/34/c.php '; Calculates the $b phase path relative to the $a.
$a = '/a/b/c/d/e.php ';
$b = '/a/b/12/34/c.php ';
To find the relative path of $b relative to $a
function Getrelativelypath ($a, $b) {
Split into arrays
$a = explode ('/', $a);
$b = explode ('/', $b);
$path = ";
Resets the index of a two array
$c = Array_values (Array_diff ($a, $b));
$d = Array_values (Array_diff ($b, $a));
Remove the filename of a path
Array_pop ($c);
Replace the directory name in the a path with the.
foreach ($c as & $v) $v = ' ... ';
Merging two arrays
$e = Array_merge ($c, $d);
Stitching paths
foreach ($e as & $v)
$path. = $v. '/';
return RTrim ($path, '/');
}
3, using the binary (also known as binary lookup method) to find an element, the image can be an ordered array.
A binary method to find out whether a value exists in an array
function Binsearchwitharray ($array, $searchValue) {
Global $time;
if (count ($array) >=1) {
$mid = Intval (count ($array)/2);
Echo ' first ', $time + +, ' times <br/> ';
Echo ' Current array: ';p rint_r ($array); Echo ' <br/> ';
Echo ' Find location index: ', $mid, ' <br/> ';
Echo ' Value: ', $array [$mid], ' <br/><br/> ';
if ($searchValue = = $array [$mid]) {
$time –;
Return $searchValue. ' was found, in the first '. $time. ', indexed as '. $mid ' <br/> ';
}
ElseIf ($searchValue < $array [$mid]) {
$array = Array_slice ($array, 0, $mid);
Return Binsearchwitharray ($array, $searchValue);
}
else{
$array = Array_slice ($array, $mid +1,count ($array));
Return Binsearchwitharray ($array, $searchValue);
}
}
return $searchValue. ' Not found <br/> ';
}
$time = 1;
The array to find
$array = Array (1,5,8,101,13,19,25,50,60,199,35);
The value to find
$searchValue = 13;
The key of the binary method of array ordering
Sort ($array);
Echo ' To find the value is: ', $searchValue, ' <br/><br/> ';
Echo Binsearchwitharray ($array, $searchValue);