- $ Img = file_get_contents ('http: // www.baidu.com/img/baidu_logo.gif ');
- File_put_contents('1.gif ', $ img );
- Echo '';
- ?>
3,
Function is_gfriend ($ na, $ nb)
- {
- $ Random1 = rand (1/5); // calculate their fate
- $ Random2 = rand (1, 5 );
- If ($ random1 ==$ random2)
- Return $ na. "+". $ nb. "You have fate ";
- Else
- Return $ na. "+". $ nb. "Unfortunately, no fate ";
}
- Echo is_gfriend (a, B );
- ?>
4, Company interview questions: Baidu web development engineer pen questions] Part 1: 1. explain the meaning of the following statement: document. form ["formname"]. submit; 2. the following statements are available:Write code. when you move the cursor over the text box, the content in the text box is automatically selected. 3. convert the character 09 to a decimal number. 4. convert 1234567890 to 1,234,567,890. every 3 digits are separated by commas. 5. I forgot about html and css. 6. enter a year in the text box to judge the Chinese zodiac and output it next to the text box. Both html and javaservlet are required. 7. ajax retrieves data from the server {id: 123, name: "baidu", username: "mm", checked: true}; analyzes the value of name ("baidu "). (The question is too long to remember) 8. about the customer experience. (Script school bbs.it-home.org editing) Answer: 1. obtain the submit button element of the formname form. 2,
3,
- $ A = "09 ";
- Echo (int) $;
- Echo"
";
- Echo intval ("09 ");
- ?>
4,
- $ Num = preg_replace ('/(? <= [0-9]) (? = (? : [0-9] {3}) + (?! [0-9])/', $ num );
- Echo $ num;?>
6,
- $ T = 1986;
- Switch ($ t)
- {
- Case 1986:
- Echo "Niu ";
- Break;
- Case "":
- Break;
- Case "":
- Break;
- ......
- }
8. analyze satisfaction, endurance, and feedback. Part 2: 1. the common idea of ajax, database triggers, gui, and interrupt mechanisms. Let's talk about this idea (mechanism ). 2.change the beginning of a single word in an English document to a large one, which is included in doc.txt. You can write your ideas in multiple programming languages (c \ c ++, java, php...) and try to optimize your program. 3. about the data structure of the tree. 4. database optimization: there is a table product (id, name, price, count); the query speed is always slow: select * from product where price = 100; when a non-clustered index is added to the price Field, the query speed is still slow. (1) analyze the cause of slow query. (2) how to optimize it. 5.
- Create table topid {
- Topicid int not null primary key auto_increment,
- Title text,
- Author varchar (30 ),
- Content blob,
- Isdeleted int
- ... // It seems that an index is defined on author.
- }
- Create table reply {
- Topicid int foreign key,
- Replyid int primary key auto_increment,
- Replyauthor varchar (30 ),
- Replytime datetime,
- Context blob
- ... // Defines an index and key
- }
-
One is the topic table and the other is the reply table. 1. what are the shortcomings of performance. 2. query the reply time does not exceed a specific period of time, the reply author name with the title of the topic starting with mike, in the following query: (Programmer's house bbs.it-home.org editor)
- Select * from topic where replyid in (select replyid from reply where
- Replyauthor like 'Mike % 'and (currenttime ()-replytime
In terms of performance, what are the shortcomings of the preceding query statements? How to optimize it? Answer: 1. the database trigger and interrupt mechanism are automatically completed by the database, while the ajax trigger is triggered by the user. Ajax asynchronously optimizes the gui and database. 2,
- $ Fp = fopen ("aa.txt", 'r'); // English document aa.txt
- While (! Feof ($ fp )){
- $ Char = fgets ($ fp );
- }
- $ E = explode (",", $ char );
- $ Write = fopen ("doc.txt", 'w'); // create if no doc.txt exists
- Foreach ($ e as $ w)
- {
- If ($ w = $ e [count ($ e)-1]) // enter if ($ w = end ($ e) without a comma in the last word ))
- $ W = ucwords ($ w); // convert the first letter to uppercase
- Else
- $ W = ucwords ($ w ).",";
- Echo $ w;
- Fwrite ($ write, $ w); // write to doc.txt
- }
- Fclose ($ write );
- Fclose ($ fp );
- ?>
|