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

Editing MIME types

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

Editing MIME types

Editing MIME types – How to change things

With MIME_Type, you can edit existing MIME types or create new ones from scratch. Just create a new instance of MIME_Type - with the MIME type string as only parameter, if you have one - or no parameter if you want to begin a new one.

To set or retrieve the media type (part before the slash), use the object's $media property. The same applies to the subtype, the property name is $subType.

If you are done editing your MIME type, use get() to retrieve the MIME type's string representation.

Working with parameters

To retrieve parameters, use the $parameters property. It is an array consisting of MIME_Type_Parameter objects if there are any.

You can remove any parameter by calling removeParameter() and passing the parameter's name as only parameter.

Parameters are added with addParameter(). It takes the $name, $value and an optional $comment as parameters.

Again: If you are done editing the parameters, use get() to retrieve the MIME type's string representation.

There are three static methods that help you working with parameters:

  • hasParameters() checks if the passed MIME type string has any parameters in it.

  • getParameters() returns an array of MIME_Type_Parameter objects if there are any parameters in the passed type string.

  • stripParameters() removes all parameters and comments from the given type string.



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

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