php_user_filter::filter
(PHP 5, PHP 7, PHP 8)
php_user_filter::filter — Called when applying the filter
说明
This method is called whenever data is read from or written to the attached stream (such as with fread() or fwrite()).
参数
in-
inis a resource pointing to abucket brigadewhich contains one or morebucketobjects containing data to be filtered. out-
outis a resource pointing to a secondbucket brigadeinto which your modified buckets should be placed. consumed-
consumed, which must always be declared by reference, should be incremented by the length of the data which your filter reads in and alters. In most cases this means you will incrementconsumedby$bucket->datalenfor each$bucket. closing-
If the stream is in the process of closing (and therefore this is the last pass through the filterchain), the
closingparameter will be set totrue.
返回值
The filter() method must return one of three values upon completion.
| Return Value | Meaning |
|---|---|
PSFS_PASS_ON |
Filter processed successfully with data available in the
out bucket brigade.
|
PSFS_FEED_ME |
Filter processed successfully, however no data was available to return. More data is required from the stream or prior filter. |
PSFS_ERR_FATAL (default) |
The filter experienced an unrecoverable error and cannot continue. |
用户贡献的备注
备份地址:http://www.lvesu.com/blog/php/php-user-filter.filter.php