您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP中的fscanf()函数

2024/3/30 17:37:38发布14次查看
the fscanf() function parses input from an open file according to a specified format. it returns the values parsed as an array, if only two parameters were passed.
syntaxfscanf(file_pointer, format, mixed)
parametersfile_pointer − a file system pointer resource created using fopen().
format − specify the format. here are the values:
%% - returns a percent%b - binary number%c - the character according to the ascii value%f - floating-point number%f - floating-point number%o - octal number%s - string%d - signed decimal number%e - scientific notation%u - unsigned decimal number%x - hexadecimal number for lowercase letters%x - hexadecimal number for uppercase lettersmixed − specify the assigned values. optional.
returnthe fscanf() function returns the values parsed as an array, if only two parameters were passed.
example<?php $file_pointer = fopen("new.txt", "r"); while ($playerrank = fscanf($handle, "%s\t%d
")) { list ($name, $rank) = $playerrank; echo “$name got rank $rank.”; } fclose($file_pointer);?>
outputamit got rank 2
以上就是php中的fscanf()函数的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product