PHP Face question 2

Source: Internet
Author: User
Tags echo date tortoisesvn
Brief title (50 points)
1. The time format of the day before printing with PHP is 2006-5-10 22:21:21 (2 minutes)
echo Date (' y-m-d h:i:s ', Strtotime ('-1 day '));
2, Echo (), print (), Print_r () difference (3 points)
ECHO is a PHP statement, print and Print_r are functions, the statement does not return a value, the function can have a return value (even if it is not used)
Print only prints out values for simple type variables (such as int,string)
Print_r can print out values for complex type variables (such as arrays, objects)
echo--output one or more strings
3, the ability to make HTML and PHP separated from the use of the template (1 points)
Smarty,heyes Template class, etc.
5. What tools are used for version control? (1 points)
VS Server on Apache as the service side, Wincvs as the client; Subversion on Apache/dav do the server, TortoiseSVN do the client, or Subclipse do the client.
6, how to implement string rollover? (3 points)
Strrev ()
---------------------------------------------------------------
7, optimize the MySQL database method. (4 points, more write more)
(1). Select the most applicable field property, you should set the field to not null as far as possible, so that in the future to execute the query, the database does not have to compare NULL values.
(2). Use connection (join) instead of subquery (sub-queries)
(3). Use Union (Union) instead of manually created temporary tables
(4). Use the LIKE keyword and wildcard characters sparingly
(5). Using Transactions and foreign keys
8, the meaning of PHP (give 1 points)
Hypertext Preprocessor
9. What is the function of MySQL to get the current time?, the function to format the date is (2 points)
Now (), Date_format (Date,format)
10, the implementation of the text string interception without garbled method. (3 points)
Mb_substr ()
---------------------------------------------------------------
11. Have you ever used version control software? If you have the name of the version control software you are using? (1 points)
TortoiseSVN-1.2.6 svn-1.2.3
12. Have you ever used a template engine? If you have the name of the template engine you are using? (1 points)
Smarty
13, please briefly describe your most proud of the development of the work (4 points)
14, for the large-volume website, what method do you use to solve the traffic problem? (4 points)
First, verify that the server hardware is sufficient to support current traffic
Second, optimize database access.
Third, prohibit the external hotlinking.
Four, control the download of large files.
V. Use different hosts to divert the main flow
VI, use traffic analysis statistics software.
-----------------------------------------------------------------
15. Use PHP to write the code showing client IP and server IP 1 points)
function Get_client_ip () {#
if (getenv (' http_client_ip ')) {
$client _ip = getenv (' http_client_ip ');
} elseif (getenv (' http_x_forwarded_for ')) {
$client _ip = getenv (' http_x_forwarded_for ');
} elseif (getenv (' remote_addr ')) {
$client _ip = getenv (' remote_addr ');
} else {
$client _ip = $HTTP _server_var[' remote_addr ');
}
return $client _ip;
}
16. What is the difference between statement include and require? To avoid including the same file multiple times, you can use (?) Statements instead of them? (2 points)
Require () and include () are exactly the same in all respects except how to deal with failures. The include () generates a warning and require () causes a fatal error.
In other words, if you want to stop processing the page when the file is lost, use require (). The include () is not the case and the script will continue to run.
Require () will contain files in any case, and include () can be selectively included.
Instead of using
Include_once
Require_once
17, how to modify the session's survival time (1 points).
$savePath = "./session_save_dir/";
$lifeTime = 24 * 3600;
Session_save_path ($savePath);
Session_set_cookie_params ($lifeTime);
Session_Start ();
18, there is a web address, such as the PHP Development Resource Network homepage: http://www.phpres.com/index.html, how to get its content? ($/min)
File_get_contents ($url)
19, in HTTP 1.0, the meaning of status code 401 is (?) If you return the prompt for "file not found", the header function is available with the statement (?);( 2 min)
Not authorized (Unauthorized)
Header ("http/1.0 403 Forbidden");
12, in PHP, Heredoc is a special string, its end flag must? (1 points)
Same as the beginning, and a newline before the end flag, followed by a semicolon
13, talk about the advantages and disadvantages of asp,php,jsp (1 points)
14. Talk about MVC (1 points)
-------------------------------------------------------------------
15, write the number of the top 10 names of SQL, using the following table: Members (Id,username,posts,pass,email) (2 points)
Select Members.username
From members
Order BY posts DESC
Limit 10
16. Please indicate the difference between the value of the transfer and the reference in PHP. When is the value passed? (2 points)
Pass by value: Any changes to values within the function scope are ignored outside the function
Pass by reference: Any changes to values within a function can also reflect these changes outside of the function
Pros and Cons: When passing by value, PHP must copy the value. This can be a costly operation, especially for large strings and objects.
Passing by reference does not require copying values, which is good for performance gains.
17. What is the function of error_reporting in PHP? (1 points)
Level used to configure the return of error messages
18. Please write a function to verify that the e-mail is in the correct format (2 points)
If the email address is valid, return True,else return False
function Validateemail ($email)
{
if (Eregi (' ^[_a-z0-9-]+ (. [ _a-z0-9-]+) *@[a-z0-9-]+ (. [ a-z0-9-]+) (*$ ', $email)) {
return true;
}else{
return false;
}
}
19. Describe how to get the current execution script path, including the obtained parameters. (2 points)
echo $_server[' Scrīpt_filename ']. "?". $_server[' query_string '];
20. How to modify the lifetime of the session. (1 points)
Setcookie ()
Or
Session_set_cookie_params ($lifeTime)
--------------------------------------------------------------------
21. JS Form Popup dialog function is? Get the input focus function? (2 points)
Alert (), Prompt (), confirm ()
Focus ()
22, JS's steering function is? How to introduce an external JS file? (2 points)
Window.location.href

23. What is the difference between foo () and @foo ()? (1 points)

@ This is mainly the role of shielding errors!


24. How do I declare a class with no methods and properties named "MyClass"? (1 points)
Class myclass{};
25. How to instantiate an object named "MyClass"? (1 points)
$newmyclass = new MyClass ();
26. How do you access and set the properties of a class? (2 points)
by-〉
$newmyclass = new MyClass ();
$temp = $newmyclass->testvalue;
$newmyclass->testvalue= "a";
27. What is the difference between mysql_fetch_row () and mysql_fetch_array? (1 points)
Mysql_fetch_row--Get a row from the result set as an enumerated array

Mysql_fetch_array--Gets a row from the result set as an associative array, or as a numeric array, or both


--------------------------------------------------------------------
28, what is the GD library for? (1 points)
The GD library provides a range of APIs for working with images, using the GD library to process images, or to create images.
The GD library on the site is often used to generate thumbnails or to add watermarks to images or generate reports on site data.
29. Point out some ways to enter HTML code in PHP. (1 points)
Print ("

");
30. Which of the following functions can open a file to read and write to a file? (1 points) (c)
(a) Fget () (b) File_open () (c) fopen () (d) Open_file ()
31. Which of the following options does not add John to the users array? (1 points) (c) (d)
(a) $users [] = ' John ';
(b) Array_add ($users, ' John ');
(c) Array_push ($users, ' John ');
(d) $users | | = ' John ';
32, the following program will enter whether or not? (1 points)
$num = 10;
function Multiply () {
$num = $num * 10;
}
Multiply ();
Echo $num;
?>
No, local variables
33, use PHP to write a simple query, find out all the name "Zhang San" content and print out (2 points)
Table name User
Name Tel Content Date
Zhang 313,333,663,366 College Graduation 2006-10-11
Zhang 313,612,312,331 Bachelor's degree 2006-10-15
Zhang Si 021-55665566 secondary school 2006-10-15

Please complete the code according to the above topic:
$mysql _db=mysql_connect ("local", "Root", "pass");
@mysql_select_db ("db", $mysql _db);
$result =mysql_query ("select * from User where Name= ' Zhang San '");
while ($row =mysql_fetch_array ($result))
{
echo $row [' Name ']. $row [' Tel ']. $row [' Content ']. $row [' Date '];
echo "
";
}
34, how to use the following class, and explain what the following mean? (3)

Class test{
function Get_test ($num) {
$num =MD5 (MD5 ($num). " En ");
return $num;
}
}
Dual MD5 encryption
$testObject = new test ();
$encryption = $testObject->get_test ("Xiaotian_ls");
----------------------------------------------------------------------------
35. Write the format of the SQL statement: INSERT, UPDATE, delete (4 points)
Table name User
Name Tel Content Date
Zhang 313,333,663,366 College Graduation 2006-10-11
Zhang 313,612,312,331 Bachelor's degree 2006-10-15
Zhang Si 021-55665566 secondary school 2006-10-15
(a) A new record (Xiao Wang 13254748547 High school 2007-05-06) please add a SQL statement to the table
INSERT into User (' Name ', ' Tel ', ' Content ', ' Date ') VALUES (' Xiao Wang ', ' 13254748547 ', ' High School graduate ', ' 2007-05-06 ')
(b) Use an SQL statement to update the Zhang San time to the current system time
UPDATE User SET Date=date_format (now (), '%y-%m-%d ') WHERE name= ' Zhang San '
(c) Please write down all records named Zhang Xi
DELETE from User WHERE name= ' Zhang four '
36. Please write the meaning of the data type (int char varchar datetime text); What is the difference between varchar and char (2 points)
37. MYSQ Self-increment type (usually the table ID field) must be set to (?) Field (1 points)
38, write out the following program output results (1 points)
$b = 201;
$c = 40;
$a = $b > $c? 4:5;
echo $a;
?>
39. Is there a function to detect whether a variable is set or not? is the function empty? (2 points)
-----------------------------------------------------------------------------
40. What is the function that gets the total number of query result sets? (1 points)
41, $arr = Array (' James ', ' Tom ', ' Symfony '); Please print out the value of the first element (1 points)
42. Separate the values of the array of 41 questions with ', ' and combine them into a string output (1 points)
43, $a = ' abcdef '; Please remove the value of $ A and print out the first letter (1 points)
44. Can PHP connect to a database such as SQL Server/oracle? (1 points)
45. Please write out the PHP5 permission control modifier (3 points)
46. Please write the PhP5 constructor and destructor (2 points)
------------------------------------------------------------------------------

47, the following please complete with phpMyAdmin

(a) Create a press release system with the following fields (3 points) for the table named message

ID Article ID
Title of title article
Content article contents
CATEGORY_ID article Category ID
Hits Click Volume

(ii) The same press release system: Table comment Record the user reply content, the field is as follows (4 points)

comment_id Reply ID
ID article ID, ID in the associated message table
Comment_content Reply Content
Now by querying the database need to get the following format of the article title list, and according to the number of replies sorted, reply to the highest ranked in the front
Article ID article title click Reply Quantity
Use an SQL statement to complete the above query, if the article does not reply to the number of replies displayed as 0

(c) The above Content management system, table category to save the classification information, the field is as follows (3 points)

category_id Int (4) not NULL auto_increment;
Categroy_name varchar (+) not null;
When a user enters an article, select the article category by selecting the drop-down menu
Write how to implement this drop-down menu
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.