php_user_filter::filter() - php 流stream类
php_user_filter::filter()
(PHP 5, PHP 7)
Called when applying the filter
说明
publicphp_user_filter::filter(resource $in,resource $out,int &$consumed,bool $closing): intThis method is called whenever data is read from or written to the attached stream (such as withfread()orfwrite()).
参数
$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 mustalwaysbe 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 increment$consumedby$bucket->datalenfor each$bucket.
$closingIf the stream is in the process of closing (and therefore this is the last pass through the filterchain),the$closingparameter will be set toTRUE
.
返回值
Thefilter()method must return one of three values upon completion.
Return Value | Meaning |
---|---|
PSFS_PASS_ON | Filter processed successfully with data available in the$outbucket 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. |
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!