PHP
1. Basic
1, the difference between session and cookie
-
Session is a data structure saved on the server to track the status of users. This data can be saved in clusters, databases, and files
-
Cookie is a mechanism for the client to save user information. It is used to record some user information and is also a way to implement Session.
2, Have you used PHP7? Know what new features are
PHP7 has achieved leapfrog improvements in performance, new operators, unified variable syntax, etc.
3, the magic variable
Asked the meaning of __dir__, this is the directory where the answer file is located
4. Magic method
This is a question that is often asked. I remember the commonly used ones. When I asked __invoke() suddenly, I was confused
__construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo()
2. Data structure and algorithm
1, Stack data structure
As long as the code can be used to achieve the data structure of the stack
2, Bubble sort
As long as the bubble sort can be realized with code
3, the difference between a complete binary tree and a full binary tree
Only the lowest two-level node degree can be less than 2, and the lowest level nodes are concentrated in the leftmost position of the binary tree is a complete binary tree
and a depth of h and 2^h-1 Full binary tree
3. Architecture related
1, What is the difference between Laravel and ThinkPHP, and what should I complain about laravel?
I introduced the differences from routing, middleware to controller, data access, view, etc.
Tucao may be a bit heavy compared to some projects.
2, Has Composer ever released its own package? (Based on Composer's PHP modular development)
I answered no, I just learned
The interviewer said that their framework is a secondary development framework based on Discuz, and based on his excellent foundation, composer dependency management has also been introduced into blabla
3, talk about the understanding of MVC
Combine project description template, view, controller relationship and basic composition
Four. Protection
1, XSS cross-site scripting attack
2, DDOS traffic attack
3. CSRF cross-site request forgery attack
4, SQL injection
Control or restrict user input in front-end forms
Filter when passing parameters and data in the backend, etc.
V. Project
1, How to solve the problem of concurrency in the project
My solution is to first control valid requests on the front end, such as a normal request once a minute.
Then the back end also considers invalid requests, and then puts the operation into the queue for implementation.
An interviewer asked, is your queue blocked? If two users buy at the same time and two users wait to complete, they still use the same thread to complete. Have you considered using other methods to achieve
I said no, he just Said that you can use the lock mechanism, the second waits for the first to complete, one by one
2, The specific implementation process of WeChat payment
1) The H5 page initiates a payment request and requests to generate a payment order.
2) Call the unified order API to generate a prepaid order.
3) Generate and sign the payment parameters called by the JSAPI page.
4) WeChat browser automatically invokes the payment JSAPI interface to pay.
5) Confirm payment
6) Asynchronously notify the merchant of the payment result, and the merchant receives the notification and return confirmation information
7) Return the payment result and display the payment information to the user
3. Simple realization of login and registration function
Each framework considers different aspects, so just write the corresponding code according to your own understanding
4. How to design a mall
I first defined myself a B2C mall, and then started from the data sheet, and then briefly introduced the front-end and back-end implementation logic
MYSQL
mysql optimization is basically the top priority, especially testing technology
1. Basic
1, What is the difference between InnoDB and MyISAM
InnoDB provides transaction processing, row-level locks, supports foreign keys, and supports multiple row formats.
MyISAM only supports table-level locks, full-text indexes, and heap tables.
2, What are the characteristics of the transaction
Atomicity, consistency, isolation, durability
3, the isolation level of the transaction
Uncommitted read, submitted read, repeatable read, serializable
4. There is a table field of O_Id, OrderDate, OrderPrice, Customer. We want to find customers whose total order amount is less than 2000
SELECT Customer,SUM(OrderPrice) FROM
Orders
GROUP BY Customer
HAVING SUM(OrderPrice)<2000
5. Query the data in the student table, if it is greater than 60, it is a pass, otherwise it fails
select 分数,类别=Case
WHEN 分数 >=60 THEN '及格'
ELSE '不及格 '
END
from 成绩表
6, Query student ID and name of students who have not completed all courses
SELECT a.SNO ,a.SNAME
FROM student a
WHERE a.`SNO` NOT IN
( SELECT b.`SNO` FROM SC b
GROUP BY b.`SNO` HAVING COUNT(*) =
( SELECT COUNT(*) FROM course)
);
2. Optimization
1, “select * from student where name=‘red’”,“select * from student where name=‘blue’”,优化语句
select name from student where
name='red'
union
select
name from student where name='blue'
If you use the or condition, the myisam table can use the index, but innodb can't.
Innodb replaces OR with UNION (for indexed columns)
2, How do you generally optimize the database
Query cache, EXPLAIN, (joint) index, use fixed-length static table
server
1. Protection
How to protect the server
Only open limited ports, restrict login IP, restrict login accounts
It is also a question for a book, which can be answered according to the project
2. Agreement
What is the difference between Get and Post
Get parameters are included in the URL, and GET requests will be actively cached by the browser. It is url-encoded, and there are character restrictions. The parameters are ASCII characters.
Post passes parameters through the request body, and there are multiple encoding methods
3. NginX
What is the process of php script request when setting nginx
The default configuration is to forward to FastCGI processing
4. Redis
1. What data do you use redis to cache
According to the project, some frequently used data that I cached
2. How does Redis do persistence and what refresh frequency to configure
Configure AOF persistence, refresh the AOF file every second by default
3. Is Redis multi-threaded?
Single thread (I actually answered multi-threaded, 233)
4. How does Redis configure one master and multiple slaves, and how long does it take?
You can use the official Redis cluster solution, which has not been practiced, and it may take several weeks to complete
V. Code Management
Have you used git? When two people submit the wrong code, how to solve it
I have used git to submit the code. If this happens, you can first git pull the remote code to the local, then modify the conflicting code or Git mark content correctly, and then resubmit the code
other
1. Why leave
Answered witty, and mentioned a little about the company or itself.
2. Your ideal team
Passion for technology, actively solve problems and cooperate together
3. Career planning
In-depth front-end, in-depth back-end, data optimization analysis collection, server penetration blabla
4. Questions to ask
Usually ask the company what projects, technical structure, profitability, etc.
The technology stacks of different companies are different, and the points of concern are also different. To some extent, they will ask about the specific blocking solution on the problem of the queue. Some will pay more attention to the efficiency of the project, and some will also pay attention to the server construction. With an understanding of popular frameworks, you may be able to find the development direction you want in the process
postscript
9 7offers in 5 days, I feel okay. During the interview, most companies will ask detailed questions based on the items on the resume. During the interview, you can see the breadth of technology (how many projects or skills have been experienced) and the depth of technology (data optimization, Framework understanding production, server attack and defense penetration), I hope everyone can continue to practice and learn technology as the project develops. (•ㅂ•)/♥ encourage each other ~
Pay attention, don't get lost
Alright, everyone, the above is the entire content of this article. The people who can see here are all talents . As I said before, there are many technical points in PHP, because there are too many, it is really impossible to write, and you will not read too much after writing it, so I will organize it into PDF and documents here, if necessary Can
Click to enter the secret code: PHP+「Platform」
For more learning content, you can visit the [Comparative Standard Factory] Catalogue of Excellent PHP Architect Tutorials, as long as you can read it to ensure that the salary will rise a step (continuous update)