note 82375 modified in wrappers.data by thiago
| From: | thiago@php.net | Date: | Thu, 18 Nov 2010 12:40:44 +0000 |
| Subject: | note 82375 modified in wrappers.data by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174151@lists.php.net to get a copy of this message | ||
Note that the official data URI scheme does not include a double slash after the colon - that you
must include it when making calls to PHP is an artifact of the designers' misunderstanding of
URL syntax.
To automatically convert proper data URIs to ones understood by PHP, you can use code such as the
following:
<?php
function convertUriForPhp( $uri ) {
if( preg_match('/^data:(?!\\/\\/)(.*)$/',$uri,$bif) ) {
return 'data://' . $bif[1];
} else {
return $uri;
}
}
?>
--was--
Note that the official data URI scheme does not include a double slash after the colon - that you
must include it when making calls to PHP is an artifact of the designers' misunderstanding of
URL syntax.
To automatically convert proper data URIs to ones understood by PHP, you can use code such as the
following:
function convertUriForPhp( $uri ) {
if( preg_match('/^data:(?!\\/\\/)(.*)$/',$uri,$bif) ) {
return 'data://' . $bif[1];
} else {
return $uri;
}
}
http://php.net/manual/en/wrappers.data.php