Foreword: the word that has harvest adds a small star please, the word that does not have harvest can object to inform against without help 3 connect
Those of you who are interested should see what ELSE I have to say about this noteBook, and HOPEFULLY that will help you.
This paper addresses
Time: 2017-11
- A PHP interview experienced by a ’16 graduate
- What is an interview
- Two, interview preparation
- Q: When do you start preparing?
- 2. Q: How do YOU prepare?
- Three, interview dry goods
- 1. An educational institution
On both sides
- What are mysql transactions
- PHP code to explain the process
- The realization principle of Baidu statistics
- How to Share sessions
- Git branch management policy
- Restful design
- Additional topic: forum table design
- Situation: The improvement of a login system
- Your most satisfied code
- Understand which design patterns, actual use cases
- 2. An e-commerce company
Three men
- Capitalizes the value of a two-dimensional array
- Use the re to get the href value of the HTML and the value of the A tag, and store the value of the A tag as the two-dimensional array with the href value as the key
- Optimized statement query
- Find the MTH largest number of N numbers
- What happens when Ajax makes cross-domain requests? How to solve
- How to optimize a CPU intensive website
- Your most satisfied code
- other
- 3. Hangzhou Branch of a b&B
One side
- The use of the phpunit
- Redis asynchronous queue implementation details
- How does Zest in Redis sort by two attributes, such as ID and age
- Your understanding of multiprocess and multithreading and coroutines
- How do you understand the componentization and modularity of current front-end frameworks
- HTTP protocol get and POST differences, how to implement
- What are you reading these days
- 4. Hangzhou branch of a crowdfunding company
On three sides
- What mysql connection does PHP use?
- Scenario question: index establishment rules and explain
- What version of PHP are you using? Why is that? What’s new in PHP7?
- Nginx related
- Since you have used Laravel and TP, compare the two frameworks
- Where you want to go, one year, three years
- other
- 5. A travel company
On both sides
- Why you left your job
- How did YOU choose PHP? About the current popular Java comparison?
- Is there any systematic training? Have you read any online courses and books on PHP?
- Since you have used Laravel and TP, compare the two frameworks
- PHP basics **
- Laravel package * *
- Where you want to go, one year, three years
- Can you ask me two questions?
- The he
- 1. An educational institution
- Iv. Summary of the interview
What is an interview
Speaking of interviews, let’s start with why you’re leaving,
- Under what circumstances would you quit your job without hesitation? It has been viewed 51826523 times.
Keywords: growth, development, grievance, leadership, money (salary) sudden feeling can grab the next and then analysis of keywords, ha ha ha
There are
- Is it true that they would rather spend 11K to hire new employees than 9K to retain old ones? Why does this happen?
Still want to see
- Must you find a new job before leaving? How do companies generally look at naked resignation and riding a donkey to find a horse?
My understanding: But once the interview is not the university entrance exam, college entrance examination (not the tutorial), the interview may have n times, as long as there is an interview, you can always go to face, face to spit it doesn’t matter, don’t be afraid of failure, the company didn’t choose you not you is not good, but you do not meet their requirement, go home and think about the interview less than place, adjust the mentality, Preparing for your next interview is the right thing to do.
Two, interview preparation
Preparation is multifaceted, as the saying goes: success is only for those who are prepared
Q: When do you start preparing?
Are you awesome? Don’t prepare for the headhunter: Be honest and ready
2. Q: How do YOU prepare?
- Project experience is part of it: interview is indispensable. Fully understand what you have done. Can you clearly describe what you have done and what role you play in the interview
- Where you share your knowledge: on a blog/Github, for example, your own summaries are more than half as effective as looking at others’ summaries
- Basic knowledge: string operation, array operation, file operation, regular operation
- Advanced knowledge: object-oriented, data structures and algorithms, design patterns, mysql indexes, mysql engines, mysql transactions, mysql locks
- Advanced knowledge: Linux +nginx+mysql+ PHP + Redis optimization, can only operate useless, who can, high concurrency, distributed system, load balancing, sub-library sub-table, message queue
Three, interview dry goods
1. An educational institutionOn both sides
What are mysql transactions
I mentioned four features of mysql, atomicity, consistency, isolation and persistence. Transactions can be understood as an operation that either completes or fails. Innodb transaction isolation levels and locks -------------//tech.meituan.com/innodb-lock.htmlCopy the code
PHP code to explain the process
I said that it was parsed into Opcode by the Zend engine and then converted into machine-aware code. I did not pay attention to this at ordinary times. I failed and failed. I checked the data "In-depth Understanding of Opcodes on THE principles of PHP" written by Bird brother.//www.laruence.com/2008/06/18/221.htmlCopy the code
The realization principle of Baidu statistics
I did not answer, their own back check ------------- reference: HTTP://blog.csdn.net/iqzq123/article/details/8877645Copy the code
How to Share sessions
I said that through Redis store session, in order to achieve the purpose of sharing, the following check under the scheme, also quite a lot of ------------- reference: HTTP://www.cnblogs.com/wangtao_20/p/3395518.html#commentformCopy the code
Git branch management policy
I wrote "master" as the main branch, "dev" as the development branch, and "bug_fix" as the bug branch. If you change the same module, there will be a conflict. After thinking about it, there will be a conflict. Then I asked the interviewer, who said you can use git rebase to change the baseCopy the code
Restful design
I said "get", "post", "PUT", "patch" and "delete", and the interviewer asked them how to use them respectively. After all, they made their own APIS and answered "Get" is to fetch resources from the server, "POST" is to create resources, "PUT" is to update complete resources, "patch" is to update part of resources, and "delete" is to delete resourcesCopy the code
Additional topic: forum table design
I forgot a little. My answer is not very good. What I asked is that there are the following requirements. The main test of how reasonable design table, such as user login information table can be how to design? How to design the post table and reply table? Content field is large, how to design better? Which fields need to be indexed?Copy the code
Situation: The improvement of a login system
Using pseudo code to achieve the first step: THE PC side only two form boxes and registration button, the back end to receive parameters, and then stored in the database second step: add mobile terminal, need to send SMS third step: add third-party login mode, need to send emails fourth step: One of my brother companies gave us a table of execl, which is the user information, and we need to register these users in the background, how to modify the existing code. Step 4: I forgot, it seems to be how to further optimize. Step 3 is not good.Copy the code
Your most satisfied code
Their own free play, the project encountered should be the best answerCopy the code
Understand which design patterns, actual use cases
Factory pattern: Define a standard that can be used to implement the corresponding function singleton pattern: prevent repeated instantiation, reduce resource calls Data mapping: Database ORM application decorator pattern: compatible with old data, polymorphic application interview how to compatible with old data, test CodereView capabilitiesCopy the code
Sleepy, let’s stop here
2. An e-commerce companyThree men
The pen test is very interesting, more can examine the level of the interviewer like me
See php7.php file 24, 25, 26 for solutions to the pen questions
Capitalizes the value of a two-dimensional array
Get the key and the value, and then double loop to uppercase.Copy the code
Use the re to get the href value of the HTML and the value of the A tag, and store the value of the A tag as the two-dimensional array with the href value as the key
It looks something like this. I simplified it
<ul class="attr"> <li> <a href="www.baidu.com"> Baidu </a> <a href='www.tecent.com'> Tengxun </a> <a Href ="www.alibaba.com"> alibaba</a> </li> </ul>Copy the code
Optimized statement query
Select Max (t_id) from test where type_id=1 and plat_id=1 select Max (t_id) from test where type_id=1 and plat_id=1
Select t_id from test where type_id= select * from test where type_id= select * from test where type_id= select * from test where type_id= select * from test where type_id= select * from test where type_id= select * from test where type_id= select * from test where type_id=1 and plat_id=1 order by t_id desc limit 1; Of course, you can further optimize the speed by adding indexes, which can be combined with (type_id/plat_id) indexes. Select * from 't_id'; select * from 'plat_id'; select * from 't_id';Copy the code
Find the MTH largest number of N numbers
Look at the algorithm, look up, right? So my idea was to sort the array, and then the N minus M numbers that I indexed would be the largest M numbersCopy the code
What happens when Ajax makes cross-domain requests? How to solve
For security reasons, set access-Control-allow-origin to *. Ha ha naive ------------- went back to search, the program is quite many. Reference HTTPS://dailc.github.io/2017/03/22/ajaxCrossDomainSolution.htmlCopy the code
How to optimize a CPU intensive website
Never practiced, right? Never mind, can you Google? Will be back? Can you keep a general idea in mind?Copy the code
Your most satisfied code
Their own free play, the project encountered should be the best answerCopy the code
other
What was the most difficult part of the project? How is it solved?
Tired, sleep
3. Hangzhou Branch of a b&BOne side
No written exams, pure interview questions, very basic, like operating system
The use of the phpunit
They usually didn't pay attention to this thing, so a pulpy, have asked the test database, I say, just using the expected data compared with the data of database found to test the interviewer asked how used the mock meng force, this concept is heard, not to do, meaning is the meaning of fraud, simulation database operations to achieve testing purposes, There are stub station pile, need more practice SAO nian o_o ------------- Reference: HTTPS://phpunit.de/manual/current/zh_cn/test-doubles.htmlCopy the code
Redis asynchronous queue implementation details
Look at my resume
I was using the laravel queue mechanism, which triggers tasks through dispatch(), and PHP artisan queue:work starts the background process to monitor the queue and complete tasks. The interviewer was not satisfied, and asked me his principle, how to achieve this? I said withlistI don't know if there is an efficient way to do this by triggering Lpush to join the team and then rPOP out of the team in turnlistData into multiplelistIn parallel processing, ZZZ.Copy the code
How does Zest in Redis sort by two attributes, such as ID and age
Google Redis zset multi-field sort -------------//segmentfault.com/q/1010000004669705Copy the code
Your understanding of multiprocess and multithreading and coroutines
As a CS major phper, I left everything I learned in college to my teacher. ZZZ
Processes can have multiple threads, in PHPyieldYou can implement coroutines, and the interviewer says what do you think about the new version of Swoole having coroutines in it? ZZZ ------------- a process is an instance of a running program. A process is the most basic unit in which the kernel allocates resources. Threads are the most basic unit in which the kernel executes.//www.cnblogs.com/lxmhhy/p/6041001.htmlCopy the code
How do you understand the componentization and modularity of current front-end frameworks
Ask me when you see me react
A react component is a class. A module means a file is a module, with its own scope ------------- http://xiaodongtongxue.top/2016/05/20/ introduction to front-end % 20 automation engineering % 20 componentization % 20 modular /Copy the code
HTTP protocol get and POST differences, how to implement
Get is used to get resources,post is used to create resources get data length is limited, POST is unrestricted GET data security in URL,post is not displayed in URL is more secure how to implement, muddlezzz ------------- Reference: HTTPS://zhuanlan.zhihu.com/p/22536382Copy the code
What are you reading these days
Send a proposition, did not read honestly did not read good, otherwise will XXXX, for example I said to see the "graphic HTTP", first asked me the above problem, and then said you read the book is not deep enough, I...Copy the code
4. Hangzhou branch of a crowdfunding companyOn three sides
What mysql connection does PHP use?
Mysqli, pdo, pdo, pdo, pdo, pdo, pdo, pDO, pdo Mysql > mysql_connect() mysql > mysql_connect() mysql > mysql_connect() mysql > mysql_connect() mysql > mysql_connect() All database work in Laravel is done through the PHP PDO facilities so make sure you have the driverfor your particular database of
choice installed on your machine before you begin development.Copy the code
Scenario question: index establishment rules and explain
There is such a table to increment the ID, name, nickname, age, customer type, creation time
Which fields need to be indexed? Why is that?
Mysql > select * from user where (' age ', 'age', 'age', 'name', 'name', 'name', 'name', 'name', 'name', 'name'); In general, you can use explain to observe SQL statements before writing SQLCopy the code
What version of PHP are you using? Why is that? What’s new in PHP7?
I've been lucky enough to use PHP7 because of the speed improvements and new features like scalar type declarations, return type declaration namespaces,TraitAutomatic loading is required by modern PHP. How does he work with autoloading? Sql_autoload_register (includeThe file will be loaded when it is used, so that it can be automatically loaded.Copy the code
Nginx related
Nginx load balancing and reverse proxy, how do you do
Can PHP-FPM delegate other ports? In addition to default 9000
What protocol does nginx use to configure phP-FPM? Is there any other agreement?
VPS built by myself, load balancing is realized through multiple ports, reverse proxy is proxy to Apache can go through other ports, need to configure INI file, go through HTTP protocol, other protocols, I do not know the interviewer said that TCP protocol, such as socketCopy the code
Since you have used Laravel and TP, compare the two frameworks
Laravel is now the most popular PHP framework, open source community is active, tools are also the most, the use of object-oriented thinking and a lot of design patterns, is worth learning and using the choice of Laravel source code read it? Container, ioc inversion of control, DI dependency injection, server Provider service provider bind bind instance into the container, and then make to resolve an instance of the container, can be directly through the facade of the static call. The interviewer says how to be compatible with the previous version, for example, if the app is released with a new version, it also needs to be compatible with the old version. I haven't done that. My idea is to one through the adapter model, meet the requirements of both, and two can use dingo/ API multi-version controlCopy the code
Where you want to go, one year, three years
Free rein, in fact, is also quite important, always correct in the positive aspects, such as in-depth PHP, extending the technology stackCopy the code
other
What was the most difficult part of the project? How is it solved?
5. A travel companyOn both sides
That’s a lot of tricks. The interviewer is very involved
Why you left your job
Be smart. Just answer the reason you left your job on the form you filled out, and don’t give it away. Hahaha.
How did YOU choose PHP? About the current popular Java comparison?
PHP is suitable for Web development, Java has a variety of options, web and Android
Is there any systematic training? Have you read any online courses and books on PHP?
I thought it meant had I gone to any training, and OF course I said no, I was talking about the great COURSES on MOOCs and Modern PHP, PHP Core Techniques and Best Practices, PHP the Right Way.Copy the code
Since you have used Laravel and TP, compare the two frameworks
Laravel is now the most popular PHP framework, open source community is active, tools are also the most, the use of object-oriented thinking and a lot of design patterns, is worth learning and using the choice of Laravel source code read it? Container, ioc inversion of control, DI dependency injection, server Provider service provider bind bind instance into the container, and then make to resolve an instance of the container, can be directly through the facade of the static call.Copy the code
PHP basics **
PHP object oriented description encapsulation, inheritance, dynamic polymorphism said At the time said become overloaded, here is one of the fan his slap, polymorphism is actually a set of interface implementation class, below the injected is the interface class, using the implementation class, so as to realize polymorphic what types of PHP is really forget, ZhangZui, not complete, saidarrayArray, String, string, object, resource,NULLCopy the code
Laravel package * *
Are dingo/ API and JwT-Auth built by themselves? Any potholes? Entrust how to use the entrust entrust? What kind of tables are there? User user table, role role table, PerM permission table, Role-User user role association table, role-perm role permission association table We also made an extension, menu menu table, menu-perm menu permission association tableCopy the code
Where you want to go, one year, three years
Free rein, in fact, is also quite important, always correct in the positive aspects, such as in-depth PHP, extending the technology stackCopy the code
Can you ask me two questions?
Black spot question mark, why two questions? Interviewer: I would like to see your focus. I said what the technical team is like here, and there is no technical sharing, and what I will do when I join the company. Don't ask me why I asked three questions, because I got the interviewer's point, hahahaCopy the code
The he
The items on your resume ask, why did you leave, what did you achieve before, and what kind of company are you looking forCopy the code
Why said routines, or you find everything ready for the interviewer's question is targeted, he pointed out my foundation is not solid, behind and said, for example a solid and a solid foundation is not doing the same thing, a solid may soon be done without error, without solid always need to Google and make things go wrong, I don't know what went wrong, because the doctrine didn't turn into its own. Then point out that I haven't systematically studied PHP because IT's easy to get started, but it takes a lot of work to learn. Finally said my planning is good, is a plus, hahaha.Copy the code
Iv. Summary of the interview
I met with 5 companies and got 3 offers. I feel good about myself, hahaha. The most important things are attitude, interview preparation, interview summary, sleep quality, water
Write quite flowing, many are a little forgotten, after all, 2 weeks later, can only remember the meaningful topic.
Those of you who are interested should see what ELSE I have to say about this noteBook, and HOPEFULLY that will help you.
Afterlanguage: if you have a harvest, please add a small star. If you have no harvest, you can oppose to report three even without help