PHP FDF获取值模块
fdf_get_value() 函数可以获取字段的值。
语法
mixed fdf_get_value( resource fdf_document , stringfieldname [, int $which = -1 ] )
fdf_get_value()函数可以获取请求字段名的值。通过传递一个可选的which参数,可以检索数组字段的元素,该参数从零开始。对于非数组字段,可忽略可选参数。
示例
<?php
fdf = fdf_open_string(HTTP_FDF_DATA);
volume = fdf_get_value(fdf, "volume");
echo "The volume field has the value '<b>volume</b>'<br />";date = fdf_get_value(fdf, "date");
echo "The date field has the value '<b>date</b>'<br />";
comment = fdf_get_value(fdf, "comment");
echo "The comment field has the value '<b>comment</b>'<br />";
if(fdf_get_value(fdf, "show_publisher") == "On") {
publisher = fdf_get_value(fdf, "publisher");
echo "The publisher field has the value <b>publisher</b>'<br />";
} else echo "Publisher shall not be shown.<br />";
if(fdf_get_value(fdf, "show_preparer") == "On") {
preparer = fdf_get_value(fdf, "preparer");
echo "The preparer field has the value '<b>preparer</b>'<br />";
} else
echo "Preparer shall not be shown.<br />";
fdf_close(fdf);
?>