????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 216.73.216.86 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/file/ |
Upload File : |
--TEST-- fread & fwrite - Test reading and writing using a single resource --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php /* * proto int fwrite(resource fp, string str [, int length]) * Function is implemented in ext/standard/file.c */ /* Prototype: string fread ( resource $handle [, int $length] ); Description: reads up to length bytes from the file pointer referenced by handle. Reading stops when up to length bytes have been read, EOF (end of file) is reached, (for network streams) when a packet becomes available, or (after opening userspace stream) when 8192 bytes have been read whichever comes first. */ $outputfile = __FILE__.".tmp"; echo "--- testing rw moving about the file ---\n"; $h = fopen($outputfile, 'wb+'); $out1 = "The 1st prrt"; $out2 = " part of the ttxt"; $out3 = "text"; fwrite($h, $out1); fseek($h, 0, SEEK_SET); echo "start:".fread($h, strlen($out1) - 5). "\n"; fwrite($h, $out2); echo "at end:".fread($h,100)."\n"; var_dump(feof($h)); fseek($h, -4, SEEK_CUR); fwrite($h, $out3); fseek($h, 0, SEEK_SET); echo "final:".fread($h, 100)."\n"; fclose($h); echo "--- testing eof ---\n"; $h = fopen($outputfile, 'ab+'); fread($h,1024); var_dump(feof($h)); fread($h,1); var_dump(feof($h)); $out = "extra"; fwrite($h, $out); var_dump(feof($h)); fread($h,1); var_dump(feof($h)); fseek($h, -strlen($out) + 1, SEEK_CUR); echo "last bytes: ".fread($h, strlen($out))."\n"; fclose($h); unlink($outputfile); echo "Done"; ?> --EXPECT-- --- testing rw moving about the file --- start:The 1st at end: bool(true) final:The 1st part of the text --- testing eof --- bool(true) bool(true) bool(true) bool(true) last bytes: xtra Done