PHP Face Test Summary

Source: Internet
Author: User
Tags create directory echo date session id php session unzip archive smarty template

1. The time format for printing out the previous day in PHP is 2006-5-10 22:21:21. echo Date (' y-m-d h:i:s ', strtotime ('-1 days '));

2. Do not use the third variable to exchange the value of two Variables. $a = "php"; $b = "java"; $a = explode ('-', $a. '-'. $b); $b = $a [0]; $a = $a [1];

3. Describe how to get the current execution script path, including the obtained parameters. Answer: $script _name = basename (__file__); Print_r ($script _name);

4. error_reporting (2047) What role? Answer: PHP Displays all error E_all.

5. PHP Heredoc is a special kind of string, its end flag must? A: The line where the end identifier is located cannot contain any other characters Except.

10. The difference between get and post submission methods in a form: get is the Send request HTTP protocol to receive via URL parameter delivery. While post is entity data, you can submit a large amount of information through a form.

11. How to find the array: (1) order Lookup--find it from beginning to End. (2) binary search--------the Search is reduced in half, so the search efficiency is Higher.

12. How to sort data: (1) bubble sort (2) Select sort (3) Insert Sort

12. How to modify session survival Time: Setcookie () and Session_set_cookie_params ($lifeTime)

14. Write the code that displays the client IP and server IP in php: $_server[' server_addr '] server ip,$_server[' remote_addr ') client ip,$_server[' remote_host '] Current user hostname, $_server[' php_self '] The name of the current script (excluding path and query string), $_server[' http_referer ' link to the URL address of the previous page of the current Page.

18.HTTP status 302, 403, 500 code meaning: 302: The temporary transfer succeeded, The requested content has been transferred to the new location; 403: forbidden; 500: Server internal Error.

18. in HTTP 1.0, the meaning of status code 401 is (not authorized), if the "file not found" prompt, the header function is available, the statement is: header ("http/1.0 404 Not Found");

Isset () and empty () difference: isset () to determine whether the existence of the existence is true, whether false or Not. Empty () Determines whether it is null, is null when it is true, and does not exist or is True.

24. The difference between a reference and a normal variable: the normal variable is a new storage space, and the reference is directed to other storage Spaces.

25. Please indicate the difference between the value and the reference in Php: when passing by value, PHP must copy the value, especially for large strings and objects, which can be a costly operation. Passing by reference does not require copying values, which is good for performance gains.

What is the difference between Php://input and $_post: $_post and Php://input can fetch a value, $HTTP _raw_post_data is Empty. $_post organizes the submitted data in an associative array, and encodes it, such as urldecode, or even transcoding. Php://input can obtain unprocessed post raw data through the input stream as a file read, php://input allows the raw data of the post to be read. Compared to $HTTP _raw_post_data, it brings less pressure to memory and does not require any special php.ini settings. Php://input cannot be used for enctype= "multipart/form-data".

37. How to tell if a window has been blocked by Javascript: A: Gets the return value of open (), or null if it is Blocked.

1. Assuming that a.html and b.html are under the same folder, the JavaScript implementation automatically jumps to b.html:settimeout ("go2b ()", 5000) after opening the a.html for five seconds;

2. Install PHP in the Apache module, and in the file http.conf, first use the statement (LoadModule Php5_module "c:/php/php5apache2.dll") to dynamically load the PHP module and then use the statement (addtype Application/x-httpd-php. Php) allows Apache to treat all files that have a php extension as PHP scripts.

3. A parameter of a function cannot be a reference to a variable unless the (allow_call_time_pass_reference Boolean) is set to on in php.ini

The function of 1.MYSQL to get the current time is: now (); the function for formatting the date is: date ().

2. What is a transaction in the Database: a transaction is a series of operations that accomplish a TASK. As long as one of these operations is unsuccessful, the transaction fails and a rollback event Occurs. That is, the previous action is undone, which guarantees consistency of the Data. And you can put the operation in the cache temporarily, and so on all operations have successfully committed the database, so that the time-consuming operation is effective operation.

5. Basic differences between MyISAM and InnoDB: MyISAM does not support transactions, and InnoDB type Support. MyISAM emphasizes performance, which executes faster than the InnoDB type, but does not provide transactional support, while InnoDB provides advanced database functionality such as transactional support and external keys.

7. What are the methods you use to solve traffic problems for Large-volume websites? ①php generate static files ②mamcached cache technology ③ Upgrade hardware ④ optimize database access ⑤ prohibit external hotlinking ⑥ control large file download ⑦ load Balancer.

8. Ways to optimize the execution efficiency of SQL Statements: avoid using ' * ' ② with the WHERE clause in the ①SELECT clause ③ avoid using calculations on indexed columns to increase the efficiency of the group BY statement by filtering out unwanted records before group by ⑤ try to set the field to not Null⑥ use a join instead of a subquery ⑦ use a foreign key, optimize the locking table ⑧ the index field to minimize the function Operation.

9.apche and Nginx: Nginx lightweight, more than Apache occupies less memory and resources, anti-concurrency, Nginx processing requests are asynchronous non-blocking, and Apache is blocking type, in high concurrency, nginx can keep low resource consumption and high performance. Apache compared to the advantages of nginx: rewrite than Nginx rewrite powerful, less bug, stable. (need performance with nginx, for stability on apache).

10. To obtain the Client's real IP address through the proxy server, use $_server["http_x_forwarded_for"] to Read.

11. Rewriting list_010_1.html to list.php?city=010&page=1 requires adding the following rewriterule_________ in the Apache Configuration. Answer: Rewriterule/list-([0-9]+)-([0-9]+) \.html$/list.php?fid=$1&page=$2. Analysis: ([0-9]+) represents 1 or more numbers, The Rewirterule statement is divided into the preceding and subsequent parts, meaning that the previous part is rewritten as a later statement, each parenthesis is a unit, the first parenthesis is replaced by the second bracket, and then by using $ $, and so On.

What is the difference between 12.Redis and memcache: memecache the data in memory, the power off will hang, the data can not exceed the memory Size. Redis is partially present on the hard drive, which guarantees the Data's Durability. Redis has more data support than memecache; Memcache performance is higher than redis.

13. about the site static file access to the performance of the method: reduce the generation of cookies, static files (slices, css, js, etc.) in different domains, the JS code to remove unnecessary spaces.

14. Examples of how to speed up the page loading speed in the development process: page compression technology (compression js), using stored procedures, put CSS style on the head, put the JS code in the tail, page cache, using gzip compressed documents, pictures using height and Width properties a directory address , and then simply load the default document index.html or index.php on the LINE. This way the server does not have to take the time to analyze this address, but also play a role in Accelerating.

15.php session in the operating mechanism: session is a server-side to maintain user session data, it is stored in the form of files on the server side, the session will be the client and the server to establish one by one connections, each client must have a unique identifier (that is, the session _id), the server through this session_id to distinguish between different clients, session_id default to establish a name called "phpsessid" Cookies (which can be specified by php.ini modification of session.name values) are stored on the client, and we can also have session_id in the address bar for transmission (modify php.ini Session.use_trans_ Sid and other parameters to change the session_id transmission mode), the client will session_id transfer to the server side, the server to transmit the session_id to find the corresponding file, read when the contents of the file is deserialized to get the value of the session, It is serialized and then written before it is Saved.

[mongodb Advantage]① Weak consistency (eventually consistent), More secure user access ② the way the document structure is stored makes it easier to get data ③ support large-capacity storage ⑤ Third-party Support Rich ⑥ performance is Superior. [mongodb disadvantage] does not support transactions, occupy large space, there is no mature maintenance tools.

17. can I use the session after disabling Cookies: in php, you can make the session non-dependent on cookies by using the relevant Configuration. This is because the session is stored on the server side (the session is stored by default), the session ID provided by the client to the User's file, get the value of the variable, Session ID can use the Client's cookie or the Http1.1 protocol query _string (the "?" of the URL that is Visited) Later) to the server, and then the server reads the session DIRECTORY. The session is working through a cookie, the session and the cookie are contacted by $_cookie[' Phpsessid '), and the ID of the session can be known through $_cookie[' PHPSESSID '). To obtain other Information.

1: List common signals and usage scenarios of Linux system: the name of the signal is defined in the header file signal.h, the signal is beginning with the sig, the commonly used signals are as follows: sigalrm, SIGHUP, SIGINT, SIGKILL, sigpipe, SIGTERM, SIGUSR1. SIGUSR2.

2: talk about the difference between the Find command and the grep command under Linux: grep is analyzing a piece of data and taking out what we want, similar to Cut. Find is used to search for files, but it is slow and takes up hard drives, usually using Whereis or locate checks, if not found, use Find.

3:linux how to see the current machine running conditions (memory usage, CPU usage, etc.)? The top command, or the free command, contains the Cache. If you want to see the actual memory usage of your application, it should be used-cached-buffers.

4: please explain the use of the following 10 shell commands (top,ps,mv,find,df,cat,chmod,chgrp,grep,wc): top: Real-time monitoring of the status of the system processor; ps: which processes are running and running; mv moving files ; find: Search file; df: disk information; cat: view file contents; chmod: set permissions; Chgrp: set the owning group; wc: the number of bytes, words, and lines in the statistics File.

7:linux, How does the Tail,grep,awk command work?

8:linux, How do I parse the log file? Tools

10: What commands will you use to find the cause when the Linux server is under high load? The question that must be made clear is: what is the performance of the failure? No response? Error? When was the fault discovered? Can the fault be reproduced? There are no rules (such as appearing every hour) .... (who's there?) w, last; what happened before? What is the process now running: pstree–a, PS aux. )

11: How to connect a server (ssh command, ssh [email protected])? How to pull down a file and upload the file: ssh,ftp,securecrt.

12:linux large file segmentation and query: split: split command, example: split-b 100m filename; query: find/-size +20000k-exec ls-lh {} \;

13: please write Linux/unix command, copy file/etc/my.cnf to/tmp directory: cp/etc/my.cnf//tmp

14: View the linux load command (cpu:uptime, memory: vmstat free, hard disk: iostat), See the commands for a process (ps aux|grep process name), What kinds of Linux common software installation methods (yum,apt).

15:linux and Windows environment development need to pay attention to what the problem: windows used to do the front section of the development of graphical interface, such as better, Linux is to build a server this comparison Cattle.

18:linux/unix command to view all the processes containing the keyword "php": ps-aux|grep php

19: Create directory for "/home/dir1": Mkdir-p/home/dir1

20: Unzip ARCHIVE.TAR.GZ:TAR-ZXVF archive.tar.gz

28:$# is the number of arguments passed to the script; $ is the name of the script itself; $ $ is the first argument passed to the shell script; the second argument passed to the shell script; [email protected] is a list of all the parameters passed to the script; $* is to display all the parameters passed to the script in a single string, and the parameters can be more than 9, unlike positional variables; $$ is the current process ID number for the script to run; is to display the exit status of the last command, 0 means no error, and the other indicates an Error.

29: statistics log related record count Awk:awk [-v variable name = variable value] [-fre] [--] ' pattern {statement} ' variable name = variable value filename

30, the domain name resolution initiates the TCP 3 handshake: establishes the TCP connection initiates the HTTP request and so on the server side responds the HTTP request, the browser obtains the HTML code, the browser parses the HTML code, and requests the HTML code the resource, The browser renders the page rendering to the user

31, Watch-n 1: is every second view followed by the command results;& background run this command

1. What is a single entry and multi-entry in the framework? What are the pros and cons of a single entry? Answer: A single entry usually refers to a project or application that has a uniform (but not necessarily Unique) portal file, which means that all the functionality of the project is done through this portal file, and often the entry file is executed in the first Step. Multiple portals run the corresponding function by accessing different PHP Files. Advantage: all HTTP requests for a single-entry application are received and forwarded to the function code via index.php, so we can do a lot of actual work in Index.php.

Cons: everything has two sides, and a single portal application is no Exception. Because all HTTP requests are for index.php, the URL of the application does not look so Beautiful. Especially for the search engine is very unfriendly.

2. List the MVC frameworks you have used, describe their pros and cons, [thinkphp] advantages: rapid development, conducive to expansion, source code disclosure; cons: inflexible, coupling too deep, Many components can not be replaced. [Yii] advantages: configurable, reusable, extensible components, disadvantages: Fewer document instances, too many English. [CI] advantages: Simple configuration, all the configuration using PHP script configuration, execution efficiency, document details; disadvantage: lack of expansion capacity, only to meet small applications.

3. When using framework (mvc) to do a project, there is no manual on how to use the template tag, what to Do: view the source Code.

The Create method in the 4.thinkphp data model probably did all those things: create (): creating data objects, Automatic data validation, data completion, token validation, field type Checking.

5. If the template is using the Smarty template, How to use the section statement to display an array named $data, if the FOREAHC statement and how to display it: {section name=sn loop= $data} {$news [sn].id}{/ section}, {foreach from= $data item=foo}{$foo}{/foreach}

12. What is a namespace, how is it declared and used: a namespace is defined as a group that sets up these classes and entities to better manage instances of classes and classes, which is an instance of the _namespace system class, or a derived class of the _namespace class , the _namespace class has only one property: Name. With this property, the user can separate a namespace from other namespaces, and the name of the namespace cannot include the underscore and suffix of the prefix. The name of the namespace followed by the keyword namespace, followed by a statement and definition enclosed in a pair of curly braces;

The main object-oriented keyword for 1.php: final makes the class non-inherited, the method is not overwritten, the parent can call member variables, member methods and constants in the members of the parents, and self, which can call static members and constants in the current class; const defines constants in the class Statically static properties and static methods, which do not need to be instantiated to be used directly; clones of a clone object.

2. What is the role of the interface, abstract class what Role: interface is open to the outside, call the interface and then rewrite the method, if you do not use the interface inside the method, then the interface is meaningless, this is for the overall code Control.

3. Singleton Mode: guarantees that there is only one instance of a class that exists and provides an access point for global access, and that instance can be accessed by all Programs. Usage Scenario: ① When a class is to be used, an instance of the class is used, and ②new creates an instance, which causes the program to waste resources, and the more instances it does not control. ③ when different threads are called, they may cause a different behavior.

4. Write your usual PHP magic method: __construct (), constructor, __destruct (), destructor, __get (), call when a member variable of a class is obtained, __set (), set a member variable of a class, __callstatic ( ), called when a non-accessible method is called in a static manner, __call () is executed automatically when a function that does not exist in the class instance is invoked, __isset () is called automatically when a private property or method exists in the class, and __unset () is automatically called when a private variable in the class is Cleared.

"some Issues on Human resources"

"self-introduction"

"the Greatest advantage of individuality"

"the Greatest disadvantage"

"the View of overtime"

"the idea of a job-hopping"

"why are you leaving the company?"

"what will you do when you disagree with your superiors?"

PHP Face Test Summary

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.