|
stream_filter_register
Register a stream filter implemented as a PHP class
derived from php_user_filter
(PHP 5)
stream_filter_register() allows you to implement your own filter on any registered stream used with all the other filesystem functions (such as fopen(), fread() etc.).
To implement a filter, you need to define a class as an extension of
stream_filter_register() will return
This method is called whenever data is read from or written to
the attached stream (such as with fread() or fwrite()).
in is a resource pointing to a
This method is called during instantiation of the filter class
object. If your filter allocates or initializes any other resources
(such as a buffer), this is the place to do it. Your implementation of
this method should return
When your filter is first instantiated, and
This method is called upon filter shutdown (typically, this is also
during stream shutdown), and is executed after
the
The example below implements a filter named Example 2375. Filter for capitalizing characters on foo-bar.txt stream<?php The above example will output: LINE1 Example 2376. Registering a generic filter class to match multiple filter names.<?php The above example will output: LINE1 See also stream_wrapper_register(), stream_filter_prepend(), and stream_filter_append(). |
Change Languagestream_bucket_append stream_bucket_make_writeable stream_bucket_new stream_bucket_prepend stream_context_create stream_context_get_default stream_context_get_options stream_context_set_option stream_context_set_params stream_copy_to_stream stream_encoding stream_filter_append stream_filter_prepend stream_filter_register stream_filter_remove stream_get_contents stream_get_filters stream_get_line stream_get_meta_data stream_get_transports stream_get_wrappers stream_register_wrapper stream_resolve_include_path stream_select stream_set_blocking stream_set_timeout stream_set_write_buffer stream_socket_accept stream_socket_client stream_socket_enable_crypto stream_socket_get_name stream_socket_pair stream_socket_recvfrom stream_socket_sendto stream_socket_server stream_socket_shutdown stream_wrapper_register stream_wrapper_restore stream_wrapper_unregister |