PHP and MySQL Web Development - P76

PHP and MySQL Web Development - P76: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Using Directory Functions 347 An associated and sometimes useful function is rewinddir dir which resets the reading of filenames to the beginning of the directory. As an alternative to these functions you can use the dir class provided by PHP. This has the properties handle and path and the methods read close and rewind which perform identically to the non-class alternatives. Getting Info About the Current Directory We can obtain some additional information given a path to a file. The dirname path and basename path functions return the directory part of the path and the filename part of the path respectively. This could be useful for our directory browser particularly if we began to build up a complex directory structure of content based on meaningful directory names and filenames. We could also add to our directory listing an indication of how much space is left for uploads by using the disk_free_space path function. If you pass this function a path to a directory it will return the number of bytes free on the disk Windows or the file system UNIX that the directory is on. Creating and Deleting Directories In addition to passively reading information about directories you can use the PHP functions mkdir and rmdir to create and delete will only be able to create or delete directories in paths that the user the script runs as has access to. Using mkdir is more complicated than you might think. It takes two parameters the path to the desired directory including the new directory name and the permissions you would like that directory to have for example mkdir tmp testing 0777 However the permissions you list are not necessarily the permissions you are going to current umask will be ANDed like subtraction with this value to get the actual permissions. For example if the umask is 022 you will get permissions of 0755. You might like to reset the umask before creating a directory to counter this effect by entering oldumask umask 0 mkdir tmp testing

Không thể tạo bản xem trước, hãy bấm tải xuống
110    29    1    28-03-2023
610    24    2    28-03-2023
Đã 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.