CVS update: php3/doc/functions
| From: | paul | Date: | Sun, 09 May 1999 03:09:52 +0000 |
| Subject: | CVS update: php3/doc/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5422@lists.php.net to get a copy of this message | ||
Date: Saturday May 8, 1999 @ 23:09
Author: paul
Update of /repository/php3/doc/functions
In directory php:/tmp/cvs-serv24675/functions
Modified Files:
filesystem.sgml http.sgml image.sgml url.sgml
Log Message:
Updated various documentation files.
Mostly were to integrate/clarify/correct based on the errata notes
Index: php3/doc/functions/filesystem.sgml
diff -u php3/doc/functions/filesystem.sgml:1.45 php3/doc/functions/filesystem.sgml:1.46
--- php3/doc/functions/filesystem.sgml:1.45 Sat May 1 02:54:15 1999
+++ php3/doc/functions/filesystem.sgml Sat May 8 23:09:52 1999
@@ -430,12 +430,28 @@
<para>
If an error occurs, returns false.
-
<para>
+ Common Pitfalls:
+ <simpara>
+ People used to the 'C' semantics of fgets should note the difference
+ in how EOF is returned.
+ <simpara>
The file pointer must be valid, and must point to a file
successfully opened by <function>fopen</function>,
<function>popen</function>, or <function>fsockopen</function>.
+ <para>
+ A simple example follows:
+ <example>
+ <title>Reading a file line by line</title>
+ <programlisting role=php>
+$fd = fopen("/tmp/inputfile.txt", "r");
+while ($buffer = fgets($fd, 4096)) {
+ echo $buffer;
+}
+fclose($fd);
+</programlisting></example>
+
<para> See also <function>fread</function>,
<function>fopen</function>, <function>popen</function>,
<function>fgetc</function>, and <function>fsockopen</function>.
Index: php3/doc/functions/http.sgml
diff -u php3/doc/functions/http.sgml:1.11 php3/doc/functions/http.sgml:1.12
--- php3/doc/functions/http.sgml:1.11 Wed Dec 9 21:07:38 1998
+++ php3/doc/functions/http.sgml Sat May 8 23:09:52 1999
@@ -69,9 +69,13 @@
</funcsynopsis>
<para>
<function>SetCookie</function> defines a cookie to be sent along
- with the rest of the header information. All the arguments
- except the <parameter>name</parameter> argument are optional. If
- only the name argument is present, the cookie by that name will
+ with the rest of the header information. Cookies must be sent
+ <emphasis>before</emphasis> any other headers are sent (this is a
+ restriction of Cookies, not PHP). This requires you to place calls
+ to this function before any <html> or <head> tags.
+ <para>
+ All the arguments except the <parameter>name</parameter> argument are
+ optional. If only the name argument is present, the cookie by that name will
be deleted from the remote client. You may also replace any
argument with an empty string (<emphasis>""</emphasis>)
in order to skip that argument. The
@@ -82,8 +86,18 @@
integer as returned by the <function>time</function> or
<function>mktime</function> functions. The
<parameter>secure</parameter> indicates that the cookie should
- only be transmitted over a secure HTTPS connection. Some
- examples follow:
+ only be transmitted over a secure HTTPS connection.
+ <para>
+ Common Pitfalls:
+ <simpara>
+ Cookies will not become visable until the next loading of a page that
+ the cookie should be visable for.
+ <simpara>
+ Multiple calls to setcookie in the same script will be performed in the reverse
+ order. If you are trying to delete one cookie before inserting another you
+ should put the insert before the delete.
+ <para>
+ Some examples follow:
<example>
<title>SetCookie examples</title>
<programlisting role=php>
@@ -96,17 +110,24 @@
urlencoded when you send the cookie, and when it is received, it
is automatically decoded and assigned to a variable by the same
name as the cookie name. To see the contents of our test
- cookie in a script, simply do:
+ cookie in a script, simply use one of the following examples:
<informalexample><programlisting role=php>
echo $TestCookie;
+echo $HTTP_COOKIE_VARS["TestCookie"];
</programlisting></informalexample>
<para>
For more information on cookies, see Netscape's cookie
specification at <ulink
url="&spec.cookies;">&spec.cookies;</ulink>.
+ <simpara>
+
<simpara>
Microsoft Internet Explorer 4 with Service Pack 1 applied does
not correctly deal with cookies that have their path parameter
set.
+ <simpara>
+ Netscape Communicator 4.05 and Microsoft Internet Explorer 3.x
+ appear to handle cookies incorrectly when the path and time
+ are not set.
</refsect1>
</refentry>
Index: php3/doc/functions/image.sgml
diff -u php3/doc/functions/image.sgml:1.21 php3/doc/functions/image.sgml:1.22
--- php3/doc/functions/image.sgml:1.21 Wed Dec 9 21:07:38 1998
+++ php3/doc/functions/image.sgml Sat May 8 23:09:52 1999
@@ -265,6 +265,26 @@
</funcsynopsis>
<para> ImageCreateFromGif returns an image identifier representing the
image obtained from the given filename.
+ <para>
+ ImageCreateFromGif returns an empty string on failure. It also outputs an
+ error message, which unfortunately displays as a broken link in a browser.
+ To ease debugging the following example will produce an error gif:
+ <example>
+ <title>Example to handle an error during creation (courtesy vic@zymsys.com
)</title>
+ <programlisting role=php>
+function LoadGif($imgname)
+{
+ $im = @imagecreatefromgif($imgname); /* Attempt to open */
+ if ($im == "") { /* See if it failed */
+ $im = ImageCreate(150,30); /* Create a blank image */
+ $bgc = ImageColorAllocate($im,255,255,255);
+ $tc = ImageColorAllocate($im,0,0,0);
+ ImageFilledRectangle($im,0,0,150,30,$bgc);
+ ImageString($im,1,5,5,"Error loading $imgname",$tc); /* Output an errmsg */
+ }
+ return $im;
+}
+</programlisting></example>
</refsect1>
</refentry>
Index: php3/doc/functions/url.sgml
diff -u php3/doc/functions/url.sgml:1.10 php3/doc/functions/url.sgml:1.11
--- php3/doc/functions/url.sgml:1.10 Wed Dec 9 21:07:42 1998
+++ php3/doc/functions/url.sgml Sat May 8 23:09:52 1999
@@ -118,6 +118,7 @@
<para>
See also:
<function>base64_decode</function>,
+ <function>chunk_split</function>,
RFC-2045 section 6.8.
</refsect1>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net