« Home « Chủ đề Professional Information Technology Book

Chủ đề : Professional Information Technology Book


Có 80+ tài liệu thuộc chủ đề "Professional Information Technology Book"

Professional Information Technology-Programming Book part 61

tailieu.vn

Go ahead and create a new file called time.php that contains Listing 1.1, in a location that can be accessed by a PHP-enabled web server. This is a slight variation on the date example shown previously.. Displaying the System Date and Time The time is. <?php echo date('H:i:s');?>. and the date is. <?php echo date('j F Y');?>. Group\Apache\htdocs , and...

Professional Information Technology-Programming Book part 62

tailieu.vn

For instance, you could have a variable called number that holds the value 5 or a variable called name that holds the value Chris . The following PHP code. If you remember that, declaring a new variable is very easy: You just use an equals symbol with the variable name on the left and the value you want it to...

Professional Information Technology-Programming Book part 63

tailieu.vn

In this lesson you have learned how variables work in PHP. A conditional statement in PHP begins with the keyword if , followed by a condition in parentheses. The following example checks whether the value of the variable $number is less than 10, and the echo statement displays its message only if this is the case:. echo "$number is less...

Professional Information Technology-Programming Book part 64

tailieu.vn

If the condition is false initially, the code block will not be repeated at all.. Infinite Loops The repeating code must perform some action that affects the condition in such a way that the loop condition will eventually no longer be met. otherwise, the loop will repeat forever.. The while loop calculates the square of that number and displays it,...

Professional Information Technology-Programming Book part 65

tailieu.vn

For instance, a script that contains the following:. However, the following two calls to mail are both valid:. The following example is a variation of add_tax that takes two argumentsthe net amount and the tax rate to add on. function add_tax_rate($amount, $rate=10. Using this function, the following two calls are both valid:. add_tax_rate(16);. add_tax_rate(16, 9);. The first example uses the...

Professional Information Technology-Programming Book part 66

tailieu.vn

This example adds 6 and 12 together and displays the result:. Division When you divide two integers, the result is an integer if it divides exactly. A fractional result is not rounded to an integer.. The following statements both add one to $number. This statement subtracts one from $countdown before displaying the result:. However, the following statement displays the current...

Professional Information Technology-Programming Book part 67

tailieu.vn

In the next lesson you will learn all about string handling in PHP.. In this lesson you will learn about some of the powerful string functions that are included in the PHP language.. The following example uses the simple format specifier %f to represent a float number.. The second argument to printf is substituted in place of %f , so...

Professional Information Technology-Programming Book part 68

tailieu.vn

In the next lesson you will examine how regular expressions are used to perform pattern matching on strings.. What Is an Array?. An array is a variable type that can store and index a set of values. An array is useful when the data you want to store has something in common or is logically grouped into a set.. By...

Professional Information Technology-Programming Book part 69

tailieu.vn

In fact, a two-dimensional array is an array of arrays. Suppose you were to use an array to store the average monthly temperature, by year, using two key. Because $temps is an array of arrays, $temps[1995] is an array of. temperatures, indexed by month, and you can reference its elements by adding the key name in square brackets.. remember that...

Professional Information Technology-Programming Book part 70

tailieu.vn

You have already seen the array function used to generate an array from a list of values. You can use asort to sort an array while maintaining the key associations, whether it is an associative array or numerically indexed. It is also possible to sort an array on the keys rather than on the element values, by using ksort ....

Professional Information Technology-Programming Book part 71

tailieu.vn

temperatures, indexed by month, and you can reference its elements by adding the key name in square brackets.. You can initialize values by using references to the individual elements, as follows:. You can also define multidimensional arrays by nesting the array function in the appropriate places. The following example defines the first few months for three years (the full array...

Professional Information Technology-Programming Book part 72

tailieu.vn

In the next lesson you will learn how to handle date and time values in PHP.. In this lesson you will learn how to store, display, and manipulate date and time values in PHP.. Unix Timestamp Format. The Unix timestamp format is an integer representation of a date and time. Right now, we have a 10-digit date and time timestamp....

Professional Information Technology-Programming Book part 73

tailieu.vn

In this lesson you have learned how to store and manipulate date and time values in PHP. In the next lesson you will learn about classes in PHP, and you will discover how to use third-party library classes that you download.. In this lesson you will learn the basics of object-oriented PHP. You will see how a class is defined...

Professional Information Technology-Programming Book part 74

tailieu.vn

Accessing the values from form items is fairly intuitive: The form item names become the element keys in $_GET or $_POST , and each value in the array is the value of the corresponding element when it was submitted.. For CHECKBOX and RADIO input types, the VALUE attribute determines the value seen by PHP. If the check box named may_contact...

Professional Information Technology-Programming Book part 75

tailieu.vn

A modular routine to generate a radio button group requires three pieces of information: the name of the group, a list of values, and a list of labels. "NAME=\"$name\". VALUE=\"$value\">";. "<br>";. At the heart of the function is a loop through $options that generates each. tag between each button in the group. If they match, the CHECKED attribute is included...

Professional Information Technology-Programming Book part 76

tailieu.vn

So far we have assumed that a form submits to a processing script, and when one or more validation errors are found, the form prompts the user to use his or her browser's Back button to fix the errors.. Not only does this create one more step for the user to take in order to complete the formand in an...

Professional Information Technology-Programming Book part 77

tailieu.vn

Cookies are small pieces of information that are stored in your web browser. Rather than having to pass data to a script by using a form or as values in the query string, cookies are sent back to your scripts automatically by your web browser.. The instruction to create a cookie in your web browser is sent as an HTTP...

Professional Information Technology-Programming Book part 78

tailieu.vn

In the next lesson you will use these techniques to create a user authentication system using PHP.. Chances are you have needed to log in to a website in the past, so you should be aware of how the process of authentication works from a user's point of view.. Basic HTTP Authentication. By using an .htaccess file on your website,...

Professional Information Technology-Programming Book part 79

tailieu.vn

HTTP Headers. The following HTTP headers show some of the information that is sent along with a typical web page from a PHP-enabled web server:. To stamp your name in the HTTP headers in your script, you could use the following:. Checking Whether Headers Have Been Sent. As soon as PHP hits the first piece of non-header output in a...

Professional Information Technology-Programming Book part 80

tailieu.vn

Now let's look at the information that PHP allows you to find out from your web server.. information about the web server environment during the current page request. You can always refer to the output from the previous statement to check which values are available in your script.. The name of the current script can be found in $_SERVER["SCRIPT_NAME". Knowing...