略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: fdf_enum_values

2024-11-14

fdf_enum_values

(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)

fdf_enum_valuesCall a user defined function for each document value

说明

fdf_enum_values(resource $fdf_document, callable $function, mixed $userdata = ?): bool
警告

本函数还未编写文档,仅有参数列表。

add a noteadd a note

User Contributed Notes 1 note

up
2
ceo at l-i-e dot com
18 years ago
If you need something like this in a pre 4.3 version, here is a rough hack I was working on before I realized I didn't need this after all.

        preg_match('/Fields\[(.*)\]/', $raw_pdf, $field_data);
        echo "Fields: ", htmlentities($field_data[1]), "<HR>\n";
        $field_data = $field_data[1];
        $key_value = explode(">><<", $field_data);
        $key_value[0] = substr($key_value[0], 2);
        $key_value[count($key_value) - 1] = substr($key_value[count($key_value) - 1], 0, -2);
        while (list(, $kv) = each($key_value)){
                list($key, $value) = explode("/V", $kv);
                $key = substr($key, 2);
                if ($key[0] == '('){
                        $key = substr($key, 1, -1);
                }
                if ($value[0] == '/'){
                        $value = substr($value, 1);
                }
                if ($value[0] == '('){
                        $value = substr($value, 1, -1);
                }
                echo "Key: $key Value: $value<BR>\n";
        }

The $raw_pdf can either be the $HTTP_RAW_POST_DATA before you write a submitted PDF, or it can just be the raw PDF data you would read from a PDF using, say:
$raw_pdf = implode("", file("/path/to/your/fdf/whatever.pdf"));

You'll probably need to tweak this to do something more interesting than just printing the stuff.

Hmmmm.  Think they'll throw me in jail for this post?  Oh well.

官方地址:https://www.php.net/manual/en/function.fdf-enum-values.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3