A php interview question _ PHP Tutorial

Source: Internet
Author: User
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
  1. 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).
  2. Echo $ _ SERVER ['php _ SELF ']; echo $ _ SERVER ["HTTP_REFERER"];

  3. Execution section Output (3 ).
  4. 0

  5. 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 ).
  6. (4) unauthorized (5) header ("HTTP/1.0 404 Not Found ");

  7. The role of the array function arsort is (6); the role of the statement error_reporting (2047) is (7 ).
  8. (6) reverse sort the array and maintain the index relationship (7) All errors and warnings

  9. The format of the database connection string in PEAR is (8 ).
  10. Write a regular expression to overwrite all JS/VBS scripts on the web page (that is, remove the tag and its content): (9 ).
  11. /<[^>]. *?>. *? <\/>/Si

  12. 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.
  13. (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

  14. 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.
  15. (12) include generates a warning when an exception occurs. require generates a fatal error (13) require_once ()/include_once ()

  16. Class attributes can be serialized and saved to the session, so that the entire class can be restored later. This function is used (14 ).
  17. Serialize ()/unserialize ()

  18. A function parameter cannot be a reference to a variable unless (15) is set to on.
  19. Allow_call_time_pass_reference

  20. 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 ).
  21. (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

  22. In PHP, heredoc is a special string whose end mark must be (18 ).
  23. The row containing the end identifier cannot contain any other characters ";"

  24. Write a function to traverse all files and subfolders in a folder.
  25. /*** 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 ;}}
  26. Briefly describe the implementation principles of unlimited classification in the forum.
  27. 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...

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.