PHP interview questions

  • 2020-05-16 06:30:15
  • OfStack

PHP basics

1. Find the value of $a
 
$a = "hello"; 
$b = &$a; 
unset($b); 
$b = "world"; 
echo $a; 

2. Find the value of $b
 
$a = 1; 
$x = &$a; 
$b = $a++; 
echo $b; 

3. Write a function to delete the specified directory including all subdirectories and files under it

4. Write a function to calculate the relative path of two files, such as:
$a = '/a/b/c/d/e.php';
= '/ a / $b b / 12/34 / c php';


javascript basics

1. Talk about several ways js can implement inheritance, and write demo

2. Talk about the js framework that you are familiar with and implement the capture of the DOM element below

< div drag="true" index="1" > < /div >
< div drag="true" index="2" > < /div >
< div drag="true" > < /div >

Request to find drag="true" and index="1" or div without index attribute

Tip: if you can't write it once, complete the following steps
1. Find drag="true" and index="1"

2. Find drag="true" and has no index attribute

3. Put the two together to get


3. Realize a mask layer effect, requiring the element to be displayed to be displayed in the center of the page

4. Investigation of closure knowledge
 
function step(a){ 
return function(x){ 
return x+a++; 
} 
} 

var a = step(10); 
var b = step(20); 
alert(a(10)); 
alert(b(20)); 
var a="123abc"; 
alert(typeof(a++)); 
alert(a); 


MySQL knowledge section

1. In a content management system, table message has the following fields
id article id
Title of title article
Content of content articles
category_id article classification id
hits clicks

Create the above table and write the MySQL statement

2. The same content management system as above: table comment records user reply content, with the following fields
Reply comment_id id
id article id, id in the message table
comment_content reply content

Now query the database to get the following format of the article title list, and in order by the number of replies, the highest reply in the first row

Article id title click response number

Complete the above query with one SQL statement. If the article does not reply, the number of replies will be 0


3. The above content management system, table category saves classification information, and the fields are as follows

category_id int(4) not null auto_increment;
categroy_name varchar(40) not null;

When the user enters an article, the article category is selected by selecting the drop-down menu

Write out how to implement this drop-down menu [PHP,JAVASCRIPT,HTML]


Mysql knowledge extension

4. The system needs to extend the classification table so that it can support unlimited classification. Please design this table structure and complete the following scenario according to your design

1. Find all articles belonging to the specified category (including all articles under the subcategory)
2. Find the classification level of the specified article to the root classification level, such as:
The article "Mysql optimization experience "is corresponding to" program design /Mysql/ operation/maintenance /"
3. When deleting a category, it is required to delete all subcategories under it


5. The system needs to add the tag function to the article (the tag and the article are many-to-many) to realize the "related article" function. Please design this table structure.
Complete the following scenario according to your design.

1. Find the 5 articles that are most similar to the specified article (the algorithm of similarity is based on the number of the same labels, and the larger the number, the more similar it will be)


Comprehensive knowledge:

1. Tell me your understanding of Cookie and Session, what are their applicable scenarios, and if possible, how to share Session in multiple applications

2. Talk about your understanding of single sign-on, such as the principle and implementation, and what problems need to be paid attention to in the process of implementation

3. Talk about your understanding of MVC, what are the disadvantages of MVC, and how would you like to implement MVC framework if you were asked to do so?

4. Tell me something about the permission management you used in your daily work. How did you understand and realize it?

Related articles: