$a = <
20, talk about the advantages and disadvantages of asp,php,jsp (1 points)
ASP is required to rely on IIS, is a language developed by Microsoft
PHP and JSP can rely on other servers such as Apache or Nginx
21. Talk about MVC (1 points)
Model: Data structure layer
View: Show
Control: Receive and judge processing input
22, write the number of the top 10 names of SQL, using the following table: Members (Id,username,posts,pass,email) (2 points)
Select top Id,username from members order by posts DESC
23. Please indicate the difference between the value of the transfer and the reference in PHP. When is the value passed? (2 points)
& Represents a reference
Parameter passing in a function changes the parameters
It is generally possible to consider using a reference when there are multiple output parameters
24. What is the function of error_reporting in PHP? (1 points)
Set the display level of error
25. Please write a function to verify that the e-mail is in the correct format (2 points)
$str = "jianfeng@126.com"; regex= "([a−z0−9\.−]+) @ ([\da−z\.−]+) \. ([A−z\.] 2,6) "; Regular return Preg_match (REGEX,STR)
26. Describe how to get the current execution script path, including the obtained parameters. (2 points)
$ARGC--Get the number of parameters
$ARGV--Get the list of parameters
27. How to modify the lifetime of the session. (1 points)
Session_set_cookie_params
28. JS Form Popup dialog function is? Get the input focus function? (2 points)
Alert ()
Confirm ()
Promopt ()
Focus ()
29, JS's steering function is? How to introduce an external JS file? (2 points)
window.location.href= "#"
30. What is the difference between foo () and @foo ()? (1 points)
@ on behalf of all warning ignored
31. How do I declare a class with no methods and properties named "MyClass"? (1 points)
Class myclass{}
32. How to instantiate an object named "MyClass"? (1 points)
$myclass = new MyClass ();
33. How do you access and set the properties of a class? (2 points)
<?phpclass a{Public $name = "A";} $a = new A (); N=a->name;print_r ($n);
34. What is the difference between mysql_fetch_row () and mysql_fetch_array? (1 points)
Mysql_fetch_array () is an extended version of Mysql_fetch_row (). In addition to storing data as a numeric index in an array, you can store the data as an associated index, using the field name as the key name.
<?phpmysql_connect ("localhost", "Mysql_user", "Mysql_password") Ordie ("Could Not connect:". Mysql_error ()); mysql_select_db ("MyDB"), $result = mysql_query ("Select ID, name from MyTable"), and while (row= Mysqlfetcharray (result, Mysql_assoc)) {printf ("ID:%s Name:%s", row["id"],row["name"]);} Mysql_free_result ($result);
35, what is the GD library for? (1 points)
Dynamic and open image processing library
36. Point out some ways to enter HTML code in PHP. (1 points)
echo "{html}" Echo <
37. Which of the following functions can open a file to read and write to a file? (1 points) c
(a) Fget () (b) File_open () (c) fopen () (d) Open_file ()
38. Which of the following options does not add John to the users array? (1 points) b
(a) $users [] = ' John ';
(b) Array_add ($users, ' John ');
(c) Array_push ($users, ' John ');
(d) $users | | = ' John ';
39, the following program will enter whether or not? (1 points) 10
$num = 10;function Multiply () {Num=num * 10;} Multiply (); Echo $num;? >
40, use PHP to write a simple query, find out all the name "Zhang San" content and print out (2 points)
Table name UserName Tel Content Date
Zhang 313,333,663,366 College Graduation 2006-10-11
Zhang 313,612,312,331 Bachelor's degree 2006-10-15
Zhang Si 021-55665566 secondary school 2006-10-15
Please complete the code according to the above topic:
$mysql _db=mysql_connect ("local", "Root", "pass"), @mysql_select_db ("db", $mysql _db); $sql = sprintf ("Select * from%s where UserName = '%s ', ' table name ', ' Zhang San '); values=mysqlquery (SQL); while (values) {echo sprintf ("Username:%s, phone%s, education:%s, Graduation Date:%s", item[' UserName '],item[' tel '], item[' Content '],item[' Date ');}
41, how to use the following class, and explain what the following mean? (3)
Class Test{function Get_test ($num) {NUM=MD5 (MD5 (num). " En "); return $num;}} $test = new test (); Ret=test->get_test (one);p rint_r ($ret); exit;
The 32-bit string generated after NUM is MD5 encoded A1 and "En" are connected and then MD5 encoded again.
42. Write the format of the SQL statement: INSERT, UPDATE, delete (4 points)
Table name UserName Tel Content Date
Zhang 313,333,663,366 College Graduation 2006-10-11
Zhang 313,612,312,331 Bachelor's degree 2006-10-15
Zhang Si 021-55665566 secondary school 2006-10-15
(a) A new record (Xiao Wang 13254748547 High school 2007-05-06) please add a SQL statement to the table
Insert into table name values (' Xiao Wang ', ' 13254748547 ', ' High School graduate ', ' 2007-05-06 ')
(b) Use an SQL statement to update the Zhang San time to the current system time
Update table name Set Date = GETDATE () where UserName = "Zhang San"
(c) Please write down all records named Zhang Xi
Delete from indicates where UserName = "Zhang Si"
43. Please write the meaning of the data type (int char varchar datetime text); What is the difference between varchar and char (2 points)
int integral type
char Storage fixed length
VARCHAR storage variable length
DateTime time
The text store gets longer
VARCHAR is variable length
CHAR (20) fixed length
44. MYSQ Self-increment type (usually the table ID field) must be set to (?) Field (1 points)
Auto_increment
45, write out the following program output results (1 points)
$b =201, $c =40;a=b> $c 4:5;echo $a;
46. Is there a function to detect whether a variable is set or not? is the function empty? (2 points)
Isset ()
Empty ()
47. What is the function that gets the total number of query result sets? (1 points)
Mysql_num_rows ()
48, $arr = Array (' James ', ' Tom ', ' Symfony '); Please print out the value of the first element (1 points)
Print_r ($arr [0]), reset ($arr);p Rint_r (current ($arr));p Rint_r (Array_shift ($arr));
49. Separate the values of the array of 41 questions with ', ' and combine them into a string output (1 points)
Implode
50, a= ' abcdef '; Please remove the value of a and print out the first letter (1 points)
$a [0];substr ($a, 0, 1);
51. Can PHP connect to a database such as SQL Server/oracle? (1 points)
OK
There are ready-made libraries
52. Please write out the PHP5 permission control modifier (3 points)
Public
Private
Protected
53. Please write the PhP5 constructor and destructor (2 points)
Public Function __construct () {}public function __destruct () {}
Programming Questions:
1. Write a function, as efficiently as possible, to remove the file's extension from a standard URL
For example: http://www.sina.com.cn/abc/de/fg.php?id=1 need to remove PHP or. php
<?php$url = "Http://www.sina.com.cn/abc/de/fg.php?id=1"; arr=parseurl (URL);p atharr=pathinfo (arr[' path ');p rint _r ($pathArr [' extension ']);
3. Write a function that calculates the relative path of the two files
such as $a = '/a/b/c/d/e.php ';
$b = '/a/b/12/34/c.php ';
Calculates the relative path of B relative to a should be http://www.bkjia.com/12/34/c.php will be added
<?php$a = '/a/b/c/d/e.php '; $b = '/a/b/12/34/c.php ';//Gets the relative path of path relative to Conpath function Sgetrelativepath (path,conpath {Patharr=explode ("/", Path), Conpatharr=explode ("/", conpath), $dismatchlen = 0; for (I=0;i < count (Patharr); i++) {if (Conpatharr[i]! = Patharr[i]) { Dismatchlen=count (Patharr)-$i; Arrleft=arrayslice (Patharr, $i); Break }} ret=strrepeat (".. /", Dismatchlen). Implode ("/", $arrLeft); return $ret;} Print_r (Sgetrelativepath (b,a));
3. Write a function that can traverse all the files and subfolders under a folder.
<?phpfunction Agetallfile ($folder) {$aFileArr = array (); if (Is_dir ($folder)) {Handle=opendir (folder); while (file= Readdir (handle))!== false) { //if yes. Or. Then skip the if (file== "." | | File = = "..") { continue; } if (Is_file (folder. " /". File)" { afilearr[]=file; } else if (Is_dir (folder. /". File) " { afilearr[file] = agetallfile (folder. ") /". file); } } closedir ($handle); } return $AFILEARR;} $path = "/home/test/sql";p Rint_r (Agetallfile ($path));
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/970855.html www.bkjia.com true http://www.bkjia.com/PHPjc/970855.html techarticle PHP Classic test questions collection, PHP Classic Questions Collection This article has analyzed the PHP classics question in detail. Share to everyone for your reference. The following: Do a bit of PHP on the Internet ...