Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17199 программистов и 1833 робота. Сейчас ищут 1717 программистов ...

Introduction

Вернуться к: Stream_Var

Introduction

Introduction – Introduction to Stream_Var

Stream_Var supplies a class that can be used as a wrapper for PHP's stream functions. This allows you to access variables with fopen(), fclose(), fwrite(), fread(), opendir() and all other filesystem functions.

You may use stream_wrapper_register() to register Stream_Var as a wrapper.

Scalar variables (strings, integers, floats) are treated as files, while arrays represent directories.

Please see the PHP Manual or the example for more information on how to register streams.

Usage scenario

Stream_Var could be used in various scenarios. Imagine you are using a class that reads data from a file but you are creating the data on-the-fly and do not want to save the data before it can be processed by the class.

This is where Stream_Var can be used. Just register it as a wrapper for fopen() and pass var://GLOBAL/yourVar as a parameter to the class.

It will read from the variable as if it was a file.



Вернуться к: Stream_Var

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware