php fscanf 函数
fscanf
( PHP 4中“ = 4.0.1 , PHP 5中)
fscanf -解析输入文件的格式根据
描述
混合fscanf (资源$处理,字符串$格式[ ,混合&$... ] )
功能fscanf ( )类似sscanf ( ) ,但需要的投入从档案与处理和解释的投入根据指定的格式,这是文献中所述的sprintf ( ) 。
任何空格的格式字符串匹配任何空白的输入流。这意味着,即使一个标签 T在格式字符串可以匹配一个单一的空格字符输入流。
每个电话fscanf ( )读取一行从档案。
参数
把柄
一个文件系统指针的资源,通常是创建使用fopen ( )函数。
格式
指定格式中所描述的sprintf ( )的文件。
...
可选的指定值。
返回值
如果只有两个参数,通过此功能,价值解析将返回一个数组。否则,如果可选参数传递,函数将返回指定数量的值。可选的参数必须通过引用传递。
修改
版本说明
4.3.0在此之前的时间,最大数量的字符读取文件是512 (或第一氮,两者排名第一) 。但现在,任意长的行会读和扫描。
实例
例如# 1 fscanf ( )为例
$handle = fopen("users.txt", "r");
while ($userinfo = fscanf($handle, "%st%st%sn")) {
list ($name, $profession, $countrycode) = $userinfo;
//... do something with the values
}
fclose($handle);
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
