Phát triển web với PHP và MySQL - p 9

Storing and Retrieving Data CHAPTER 2 55 If the filename you use begins with ftp://, a passive mode FTP connection will be opened to the server you specify and a pointer to the start of the file will be returned. If the filename you use begins with http://, an HTTP connection will be opened to the server you specify and a pointer to the response will be returned. When using HTTP mode, you must specify trailing slashes on directory names, as shown in the following: not 2 STORING AND RETRIEVING DATA When you specify the latter form of address (without the slash), a Web server will. | Storing and Retrieving Data 55 Chapter 2 If the filename you use begins with ftp a passive mode FTP connection will be opened to the server you specify and a pointer to the start of the file will be returned. If the filename you use begins with http an HTTP connection will be opened to the server you specify and a pointer to the response will be returned. When using HTTP mode you must specify trailing slashes on directory names as shown in the following http not http When you specify the latter form of address without the slash a Web server will normally use an HTTP redirect to send you to the first address with the slash . Try it in your browser. The fopen function does not support HTTP redirects so you must specify URLs that refer to directories with a trailing slash. Remember that the domain names in your URL are not case sensitive but the path and filename might be. Problems Opening Files A common error you might make while trying to open a file is trying to open a file you don t have permission to read or write to. PHP will give you a warning similar to the one shown in Figure . 2 Storing and Retrieving Data Figure PHP will specifically warn you when a file can t be opened. 56 Using PHP Part I If you get this error you need to make sure that the user that the script runs as has permission to access the file you are trying to use. Depending on how your server is set up the script might be running as the Web server user or as the owner of the directory that the script is in. On most systems the script will run as the Web server user. If your script was on a UNIX system in the public_html chapter2 directory you would create a world writeable directory in which to store the order by typing the following mkdir - orders chmod 777 - orders Bear in mind that directories and files that anybody can write to are dangerous. You should not have directories that are accessible directly from the Web as writable. For this reason our orders

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
24    19    1    27-11-2024
Đã 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.