PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Glob> <압축 스트림
Last updated: Fri, 30 Jan 2009

view this page in

Data (RFC 2397)

data: (» RFC 2397) 스트림 래퍼는 PHP 5.2.0부터 사용할 수 있습니다.

Example #1 data:// 내용 출력하기

<?php
// "I love PHP" 출력
echo file_get_contents('data://text/plain;base64,SSBsb3ZlIFBIUAo=');
?>

Example #2 미디어 형식 가져오기

<?php
$fp   
fopen('data://text/plain;base64,''r');
$meta stream_get_meta_data($fp);

// prints "text/plain"
echo $meta['mediatype'];
?>

래퍼 요약
속성 지원
allow_url_fopen으로 제한 아니오
allow_url_include로 제한
읽기 허용
쓰기 허용 아니오
추가 허용 아니오
동시 읽기/쓰기 허용 아니오
stat() 지원 아니오
unlink() 지원 아니오
rename() 지원 아니오
mkdir() 지원 아니오
rmdir() 지원 아니오



add a note add a note User Contributed Notes
Data (RFC 2397)
sandaimespaceman at gmail dot com
07-Sep-2008 04:30
Now PHP supports data: protocol w/out "//" like data:text/plain, not data://text/plain,

I tried it.
togos00 at gmail dot com
08-Apr-2008 10:56
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;
    }
}

Glob> <압축 스트림
Last updated: Fri, 30 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites