TAILIEUCHUNG - PHP and MySQL by Example- P10

Tham khảo tài liệu 'php and mysql by example- p10', 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ả | The ftell Function-Finding the Current Position in a File If you have read some data from a file and want to keep track of where you were in the file when you stopped reading the ftell function will return the current byte position the number of bytes from the beginning of the file and where the next read operation will start. This can be used in conjunction with the seek function to return to the correct position in the file. If you are using text mode the carriage return and linefeed translation will be part of the byte count. Format int ftell resource handle Example filehandle myfile r contents fgets filehandle 1024 echo ftell filehandle Current read postion in bytes starting at byte 1024 Example . Code View html head title The ftell Function title head body bgcolor lavender h3 Marking a Position in a File h3 pre php filename c wamp www exemples filename _SERVER DOCUMENT_ROOT exemples if file_exists filename print No such file or directory exit 1 fh fopen filename r 2 substring eastern while feof fh line_of_text fgets fh echo line_of_text 3 if substr_count line_of_text substring 4 bytes ftell fh if isset bytes echo substring not found br exit 5 fseek fh bytes SEEK_SET echo hr echo b Start reading again from byte position bytes b br while feof fh 6 line_of_text fgets fh echo line_of_text fclose fh pre body html Please purchase PDF Split-Merge on to remove this watermark. Explanation 1 A file is opened for reading. 2 The variable substring is assigned the string eastern a string that will be searched for in the file that was just opened. 3 As each line is read from the file the substr_count function will search for the string eastern in a line and return the number of times it was found. The first time this function returns 1 or more the next line will be entered. 4 The fteii function will return the byte position of where the next read operation will take place. The line containing eastern has already been read. The byte .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.