PHPCon Poland 2024


(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)

fdf_get_valueRetourne la valeur d'un champ FDF


fdf_get_value(resource $fdf_document, string $fieldname, int $which = -1): mixed

Retourne la valeur d'un champ FDF.

Liste de paramètres


Le gestionnaire de document FDF, retourné par la fonction fdf_create(), la fonction fdf_open() ou la fonction fdf_open_string().


Nom du champ FDF, sous la forme d'une chaîne de caractères.


Les éléments d'un champ tableau peuvent être lus en fournissant ce paramètre optionnel, sous la forme d'un entier dont la plus petite valeur sera 0. Pour les champs qui ne sont pas des tableaux, ce paramètre optionnel sera ignoré.

Valeurs de retour

Retourne la valeur du champ.


Version Description
4.3.0 Le support des tableaux et le paramètre which on été ajoutés.

Voir aussi

add a note

User Contributed Notes 1 note

mclinden at informed dot net
21 years ago
(i filed a bug report/feature request for this on and assigned it to myself

The default behavior for the FDF Toolkit is to return an FDFErcNoValue for the FDFGetValue when the field exists but has no value.

Whether or not this is truly an error is debateable. It seems to become an issue in documents created by Acrobat 5 when optional fields are included in a form with required fields since the default behavior seems to be to populate the HTTP_FDF_DATA with the results of the FDFNextFieldName enumerator, which would include the fields which have no value.

This would not be a problem except that the PHP function fdf_get_value() does not specifically test for the FDFErcNoValue condition but, instead, tests for the more general FDFErcOK. If this value is not the result of the error code, the system issues warnings (the display of which could be turned off), but the broader question is, should this be a warning condition at all?

Put another way, should a return of FDFErcNoValue for FDFGetValue be considered an event worth generating a warning?
To Top