What is the difference between 1.session and cookies?
A: Session: Store the globally unique variables accessed by the user, stored in the location of the PHP specified directory (SESSION_DIR) on the server
Cookies: Used to store continuous access to a page, stored on the client, and stored in the temp directory of user win for cookies.
Both can set the length of time by Time
2. How to modify the lifetime of sessions
A: Method 1: Set the Session.gc_maxlifetime in php.ini to 9999 to restart Apache
Method 2: $savePath = "./session_save_dir/";
$lifeTime = hour * seconds;
Session_save_path ($savePath);
Session_set_cookie_params ($lifeTime);
Session_Start ();
Methods 3:setcookie () and Session_set_cookie_params ($lifeTime);
What's 3.PHP?
A: PHP is a scripting language that creates dynamic Web sites based on the server side, and you can use PHP and HTML to build your home page
4. What is the difference between statement include and require? To avoid including the same file multiple times, available (?) Statements instead of them? (2 points)
A: Require->require is the unconditional inclusion that is, if a process to join the require, regardless of whether the conditions are established will be executed first require
Include->include has a return value, and require does not (probably because it is so require faster than include)
Note: Require is fatal when the containing file does not exist, or if the syntax is incorrect, include is not
5. Talk about the pros and cons of asp,php,jsp
A: The ASP full name Active Server Pages is a Web server-side development environment that can be used to generate and transport
A: Row dynamic, interactive, high-performance Web Service applications. ASP uses scripting language VB Script Java script
) as their own development language.
PHP is a cross-platform, server-side embedded scripting language. It borrows heavily from the syntax of C,java and the Perl language
, and coupling PHP's own features to enable Web developers to quickly write dynamically generated pages. It supports the vast majority of the current
According to the library. Also, PHP is completely free, without spending money, you can get from the PHP official site (http://www.php.ne
T) free download. And you can gain unlimited access to the source code, and you can even add the features you need.
JSP is the Sun introduced a new generation of site development language, he completely solved the current asp,php a common problem-
Script-level execution (it is said that PHP4 has been implemented with the support of Zend). Sun is using its own JAV.
A on the extraordinary accomplishments, Java from Java applications and Java applets, but also a new fruit, is JS
P--java Server Page. JSP can complete the powerful site with the support of Serverlet and JavaBean
Program.
All three provide the ability to mix some kind of program code in HTML code and the language engine to interpret the execution code.
However, the JSP code is compiled into a Servlet and interpreted by the Java virtual machine, which is only done on the JSP page
Occurs the first time the request is requested. In ASP, PHP, JSP Environment, HTML code is mainly responsible for describing the display of information style
, and the program code is used to describe the processing logic. Ordinary HTML pages rely on WEB servers only, while ASP, PH
P, JSP pages need additional language engine analysis and execute program code. The execution results of the program code are embedded in the
HTML code, and then send it to the browser together. ASP, PHP, JSP three are WEB server-oriented technology
, the client browser does not require any additional software support.
5. Talk about the understanding of MVC and enumerate the common frameworks?
A: MVC is a design pattern that makes it mandatory to separate the input, processing, and output of an application. The MVC application is divided into three core components: models, views, controllers. Each of them handles its own task.
A view is an interface that users see and interact with.
The model represents enterprise data and business rules.
The controller accepts input from the user and invokes the model and view to fulfill the user's needs.
Advantages of MVC: Low coupling, high reusability and applicability, low lifecycle cost, rapid deployment, maintainability, scalability, and benefit of software engineering management
The downside of MVC: without a clear definition, it's not easy to fully understand MVC. Not suitable for small scale applications.
Smarty,zend Framework,thinkphp,phplib Template
6.php How do I throw an exception?
A: Using Try...catch, the exception's code is placed inside the try block, and if no exception is fired, the code continues to execute and an exception is thrown if the exception is triggered.
The catch code block catches the exception and creates an object that contains exception information. $e->getmessage () to output an exception error message.
7. Talk about the difference between the values and references in PHP?
A: Pass by value: Any change in function scope to value will be ignored outside the function
Passing by reference: any changes to values within a function range can also reflect these changes outside the function
Pros and Cons: when passed by value, PHP must copy the value. This would be a costly operation, especially for large strings and objects.
Passing by reference does not require copying values, which is good for performance improvement.
What is the difference between include and require in 8,php?
A: PHP will have to be interpreted once when it encounters include, if it is 10 times on the same page, it is explained 10 times. When PHP encounters a require, no matter how many times it appears in the same PHP Web page, require,php only explains it once.
Second, require execution efficiency is higher than include.
The content contained in require is regarded as an integral part of the current file, so the PHP script is no longer executed when the included file has a syntax error or the file does not exist. The Include function is the equivalent of specifying the path to the file, and does not affect the execution of the program when the included file is wrong.
The include can be judged whether it contains, and require is included in any case
9. What is the difference between get and post submission methods in a form?
A: Get is send request HTTP protocol through URL parameter pass to receive,
Post is an entity data that can submit a large amount of information through a form.
12.echo (), print (), Print_r () difference (3 points)
A: ECHO is a PHP statement, print and Print_r are functions, statements have no return value, and functions can have return values (even if they are not used)
Print () only prints the value of a simple type variable (such as int,string)
Print_r () can print out the values of complex type variables (such as arrays, objects)
echo outputs one or more strings
11. What are the transactions in the database?
A: a transaction (transaction) is an ordered set of database operations as a unit. If all the operations in the group succeed, the transaction is considered successful, even if only one operation fails, and the transaction is unsuccessful. If all operations are completed,
Transactions are committed and their modifications are made to all other database processes. If an operation fails, the transaction is rolled back and the effect of the operation on the firm is canceled.
12. Server Apache two mode of operation and difference
A: 1.PREFORK.C module (a non-threading, pre-derived MPM)
Prefork MPM uses multiple child processes, with only one thread per child process. Each process can maintain only one connection at a certain time. On most platforms, Prefork MPM is more efficient than worker MPM, but memory usage is much higher.
2. WORKER.C module (multiple-process multi-processing module supporting mixed multithreading)
Worker MPM uses multiple child processes, each of which has multiple threads.