<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Data (RFC 2397)</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="List of Supported Protocols/Wrappers" HREF="wrappers.html"><LINK REL="PREVIOUS" TITLE="Compression Streams" HREF="wrappers.compression.html"><LINK REL="NEXT" TITLE="Secure Shell 2" HREF="wrappers.ssh2.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="wrappers.compression.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Apêndice N. List of Supported Protocols/Wrappers</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="wrappers.ssh2.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="wrappers.data" >Data (RFC 2397)</A ></H1 ><P > The <TT CLASS="filename" >data:</TT > (<A HREF="http://www.faqs.org/rfcs/rfc2397" TARGET="_top" >RFC 2397</A >) stream wrapper is available since PHP 5.2.0. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN288859" ></A ><P ><B >Exemplo N-4. Print data:// contents</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// prints "I love PHP"<br /></font><font color="#007700">echo </font><font color="#0000BB">file_get_contents</font><font color="#007700">(</font><font color="#DD0000">'data://text/plain;base64,SSBsb3ZlIFBIUAo='</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN288862" ></A ><P ><B >Exemplo N-5. Fetch the media type</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$fp </font><font color="#007700">= </font><font color="#0000BB">fopen</font><font color="#007700">(</font><font color="#DD0000">'data://text/plain;base64,'</font><font color="#007700">, </font><font color="#DD0000">'r'</font><font color="#007700">);<br /></font><font color="#0000BB">$meta </font><font color="#007700">= </font><font color="#0000BB">stream_get_meta_data</font><font color="#007700">(</font><font color="#0000BB">$fp</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// prints "text/plain"<br /></font><font color="#007700">echo </font><font color="#0000BB">$meta</font><font color="#007700">[</font><font color="#DD0000">'mediatype'</font><font color="#007700">];<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > <DIV CLASS="table" ><A NAME="AEN288866" ></A ><P ><B >Tabela N-8. Wrapper Summary</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Attribute</TH ><TH >Supported</TH ></TR ></THEAD ><TBODY ><TR ><TD >Restricted by <A HREF="ref.filesystem.html#ini.allow-url-fopen" >allow_url_fopen</A ></TD ><TD >No</TD ></TR ><TR ><TD >Restricted by <A HREF="ref.filesystem.html#ini.allow-url-include" >allow_url_include</A ></TD ><TD >Yes</TD ></TR ><TR ><TD >Allows Reading</TD ><TD >Yes</TD ></TR ><TR ><TD >Allows Writing</TD ><TD >No</TD ></TR ><TR ><TD >Allows Appending</TD ><TD >No</TD ></TR ><TR ><TD >Allows Simultaneous Reading and Writing</TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.stat.html" ><B CLASS="function" >stat()</B ></A ></TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.unlink.html" ><B CLASS="function" >unlink()</B ></A ></TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.rename.html" ><B CLASS="function" >rename()</B ></A ></TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.mkdir.html" ><B CLASS="function" >mkdir()</B ></A ></TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.rmdir.html" ><B CLASS="function" >rmdir()</B ></A ></TD ><TD >No</TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="wrappers.compression.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="wrappers.ssh2.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Compression Streams</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="wrappers.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Secure Shell 2</TD ></TR ></TABLE ></DIV ></BODY ></HTML >