A php interview question. In PHP, the name of the current script (excluding the path and query string) is recorded in the predefined variable (1), and the URL linked to the current page is recorded in the predefined variable (2). Ech
- In PHP, the name of the current script (excluding the path and query string) is recorded in the predefined variable (1), and the URL linked to the current page is recorded in the predefined variable (2).
Echo $ _ SERVER ['php _ SELF ']; echo $ _ SERVER ["HTTP_REFERER"];
- Execution section Output (3 ).
0
- In HTTP 1.0, status code 401 indicates (4). If the message "File Not Found" is returned, the header function is available. The statement is (5 ).
(4) unauthorized (5) header ("HTTP/1.0 404 Not Found ");
- The role of the array function arsort is (6); the role of the statement error_reporting (2047) is (7 ).
(6) reverse sort the array and maintain the index relationship (7) All errors and warnings
- The format of the database connection string in PEAR is (8 ).
- Write a regular expression to overwrite all JS/VBS scripts on the web page (that is, remove the tag and its content): (9 ).
/<[^>]. *?>. *? <\/>/Si
- Install PHP using the Apache module in the http. in the conf file, first use statement (10) to dynamically load the PHP module, and then use statement (11) to make Apache process all files with the extension of php as PHP scripts.
(10) LoadModule php5_module "D:/xampp/apache/bin/php5apache2. dll "(11) AddType application/x-httpd-php-source. phps AddType application/x-httpd-php. php. php5. php4. php3. phtml
- The statement include and require can both include another file to the current file. The difference is (12). to avoid multiple inclusion of the same file, you can use the statement (13) to replace them.
(12) include generates a warning when an exception occurs. require generates a fatal error (13) require_once ()/include_once ()
- Class attributes can be serialized and saved to the session, so that the entire class can be restored later. This function is used (14 ).
Serialize ()/unserialize ()
- A function parameter cannot be a reference to a variable unless (15) is set to on.
Allow_call_time_pass_reference
- The meaning of left join in SQL is (16 ). If tbl_user records the student's name and student ID, tbl_score records the student's student ID (ID) (which is not recorded after some students take the test) to print the name of each student and the total score of each subject, use the SQL statement (17 ).
(16) natural left outer join (17) select name, count (score) as sum_score from tbl_user left join tbl_score on tbl_user.ID = tbl_score.ID group by tbl_user.ID
- In PHP, heredoc is a special string whose end mark must be (18 ).
The row containing the end identifier cannot contain any other characters ";"
- Write a function to traverse all files and subfolders in a folder.
/*** Traverse the directory and save the result to an array. Php4 and above are supported. Php5 and later use the scandir () function to replace the while loop. * @ Param string $ dir * @ return array */my_scandir ($ dir) {$ files = array (); if ($ handle = opendir ($ dir )) {while ($ file = readdir ($ handle ))! = False) {if ($ file! = "..." & $ File! = ". ") {If (is_dir ($ dir. "/". $ file) {$ files [$ file] = rec_scandir ($ dir. "/". $ file) ;}else {$ files [] = $ file ;}} closedir ($ handle); return $ files ;}}
- Briefly describe the implementation principles of unlimited classification in the forum.
- Design a webpage so that a full screen window is displayed when it is opened, which contains a text box and a button. After entering information in the text box, you can click the button to close the window, but the entered information is displayed on the main page.
Dimensions (excluding paths and query strings) are recorded in predefined variables (1), and URLs linked to the current page are recorded in predefined variables (2. Ech...