tailieunhanh - Professional Information Technology-Programming Book part 65

Tham khảo tài liệu 'professional information technology-programming book part 65', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Arguments and Return Values Every function call consists of the function name followed by a list of arguments in parentheses. If there is more than one argument the list items are separated with commas. Some functions do not require any arguments at all but a pair of parentheses is still requiredeven if there are no arguments contained in them. The built-in function phpinfo generates a web page that contains a lot of information about the PHP module. This function does not require any arguments so it can be called from a script that is as simple as php phpinfo If you create this script and point a web browser at it you will see a web page that contains system information and configuration settings. Returning Success or Failure Because phpinfo generates its own output you do not need to prefix it with echo but for the same reason you cannot assign the web page it produces to a variable. In fact the return value from phpinfo is the integer value 1. Returning True and False Functions that do not have an explicit return value usually use a return code to indicate whether their operation has completed successfully. A zero value FALSE indicates failure and a nonzero value TRUE indicates success. The following example uses the mail function to attempt to send an email from a PHP script. The first three arguments to mail specify the recipient s email address the message subject and the message body. The return value of mail is used in an if condition to check whether the function was successful if mail chris@ Hello This is a test email echo Email was sent successfully else echo Email could not be sent If the web server that this script is run on is not properly configured to send email or if there is some other error when trying to send mail will return zero indicating that the email could not be sent. A nonzero value indicates that the message was handed off to your mail server for sending. Return Values Although you will not always need to test the return .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.