text
stringlengths
1
254
output
stringlengths
2
255
Prev
php_stream_getc() may block in the same way as php_stream_read() blocks.
php_stream_eof
The internal position of the stream is advanced by 1 if successful.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
A NUL terminating character is stored as the last character in the buffer.
php_stream_read() returns buf when successful or NULL otherwise.
The internal position of the stream is advanced by the number of bytes that were read, so that subsequent reads will continue reading from that point.
The internal position of the stream is advanced by the number of bytes that were read, so that subsequent reads will continue reading from that point.
Prev
This function may block in the same way as php_stream_read().
php_stream_is() returns 1 if stream is of the type specified by istype, or 0 otherwise.
(no version information, might be only in CVS)
The stream is implemented using the userspace object implementation
php_stream_is() returns 1 if stream is of the type specified by istype, or 0 otherwise.
The stream is implemented using the grow-on-demand memory stream implementation
衚 43-1Values for istype
This function is implemented as a simple (and fast) pointer comparision, and does not change the stream state in any way.
泚意 This function is implemented as a simple (and fast) pointer comparision, and does not change the stream state in any way.
Prev
See also php_stream_cast() and php_stream_can_cast().
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Prev
php_stream_is_persistent() returns 1 if the stream is a persistent stream, 0 otherwise.
php_stream_make_seekable() checks if origstream is seekable.
(no version information, might be only in CVS)
If successful, newstream is always set to the stream that is valid to use, even if the original stream was seekable.
php_stream_make_seekable() checks if origstream is seekable. If it is not, it will copy the data into a new temporary stream. If successful, newstream is always set to the stream that is valid to use, even if the original stream was seekable.
You should not access origstream anymore.
衚 43-1 php_stream_make_seekable() return values
An error occurred while attempting conversion that has left origstream in an indeterminate state. newstream is set to NULL and it is highly recommended that you close origstream.
泚意 If you need to seek and write to the stream, it does not make sense to use this function, because the stream it returns is not guaranteed to be bound to the same resource as the original stream.
Note:
泚意 If you only need to seek forwards, there is no need to call this function, as the streams API will emulate forward seeks when the whence parameter is SEEK_CUR.
Note:
泚意 If origstream is network based, this function will block until the whole contents have been downloaded.
This function may cause the underlying stream to be closed which could cause a crash when the script next accesses the file pointer!
泚意 NEVER call this function with an origstream that is reference by a file pointer in a PHP script! This function may cause the underlying stream to be closed which could cause a crash when the script next accesses the file pointer!
php_stream_opendir() returns a stream that can be used to list the files that are contained in the directory specified by path.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
(no version information, might be only in CVS)
This is a convenient shortcut for extensions that pass FILE* to third-party libraries.
php_stream_open_wrapper_as_file() is exactly like php_stream_open_wrapper(), but converts the stream into an ANSI stdio FILE* and returns that instead of the stream. This is a convenient shortcut for extensions that pass FILE* to third-party libraries.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
To find out more about stream contexts, see XXX
php_stream_open_wrapper_ex() is exactly like php_stream_open_wrapper(), but allows you to specify a php_stream_context object using context. To find out more about stream contexts, see XXX
php_stream_open_wrapper() opens a stream on the file, URL or other wrapped resource specified by path.
(no version information, might be only in CVS)
Any remote files will be created according to the URL wrapper that was used to open the file, and the credentials supplied to the remote server.
Open text file for reading. The stream is positioned at the beginning of the file.
Open text file for reading and writing.
Open text file for reading and writing. The stream is positioned at the beginning of the file.
The stream is positioned at the beginning of the file.
Truncate the file to zero length or create text file for writing. The stream is positioned at the beginning of the file.
The stream is positioned at the beginning of the file.
Open text file for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file.
Open text file for reading and writing.
Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file.
options affects how the path / URL of the stream is interpreted, safe mode checks and actions taken if there is an error during opening of the stream.
Open text file for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file.
If opened is not NULL, it will be set to a string containing the name of the actual file / resource that was opened.
options affects how the path/URL of the stream is interpreted, safe mode checks and actions taken if there is an error during opening of the stream. See Stream open options for more information about options.
It will, however, be the name of the original resource from which the seekable stream was manufactured.
泚意 If you specified STREAM_MUST_SEEK in options, the path returned in opened may not be the name of the actual stream that was returned to you. It will, however, be the name of the original resource from which the seekable stream was manufactured.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
php_stream_readdir() reads the next directory entry from dirstream and stores it into ent.
(no version information, might be only in CVS)
See php_stream_dirent for more details about the information returned for each directory entry.
php_stream_readdir() reads the next directory entry from dirstream and stores it into ent. If the function succeeds, the return value is ent. If the function fails, the return value is NULL.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
php_stream_read() returns the number of bytes that were read successfully.
php_stream_read() reads up to count bytes of data from stream and copies them into the buffer buf.
The internal position of the stream is advanced by the number of bytes that were read, so that subsequent reads will continue reading from that point.
php_stream_read() returns the number of bytes that were read successfully. There is no distinction between a failed read or an end-of-file condition - use php_stream_eof() to test for an EOF.
By default, a stream is opened in blocking mode.
The internal position of the stream is advanced by the number of bytes that were read, so that subsequent reads will continue reading from that point.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Returns 0 on success, but -1 on failure.
php_stream_rewinddir() rewinds a directory stream to the first entry. Returns 0 on success, but -1 on failure.
php_stream_seek() repositions the internal position of stream.
(no version information, might be only in CVS)
Note:
php_stream_seek() returns 0 on success, but -1 if there was an error.
The emulation is only applied when the underlying stream implementation does not support seeking.
泚意 Not all streams support seeking, although the streams API will emulate a seek if whence is set to SEEK_CUR and offset is positive, by calling php_stream_read() to read (and discard) offset bytes.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Generally speaking, this parameter will usually be 0.
php_stream_sock_open_from_socket() returns a stream based on the socket. persistent is a flag that controls whether the stream is opened as a persistent stream. Generally speaking, this parameter will usually be 0.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Generally speaking, this parameter will usually be 0.
persistent is a flag the controls whether the stream is opened as a persistent stream. Generally speaking, this parameter will usually be 0.
If the connection attempt takes longer than the timeout value, the connection attempt is aborted and NULL is returned to indicate that the stream could not be opened.
If not NULL, timeout specifies a maximum time to allow for the connection to be made. If the connection attempt takes longer than the timeout value, the connection attempt is aborted and NULL is returned to indicate that the stream could not be opened.
The reason for this is because there is no portable way to implement a non-blocking DNS lookup.
泚意 The timeout value does not include the time taken to perform a DNS lookup. The reason for this is because there is no portable way to implement a non-blocking DNS lookup.
The timeout only applies to the connection phase; if you need to set timeouts for subsequent read or write operations, you should use php_stream_sock_set_timeout() to configure the timeout duration for your stream once it has been opened.
The timeout only applies to the connection phase; if you need to set timeouts for subsequent read or write operations, you should use php_stream_sock_set_timeout() to configure the timeout duration for your stream once it has been opened.
Prev
The streams API places no restrictions on the values you use for socktype, but encourages you to consider the portability of values you choose before you release your extension.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Prev
泚意 This function treats path in a binary safe manner, suitable for use on systems with an abstract namespace (such as Linux), where the first character of path is a NUL character.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
(no version information, might be only in CVS)
(no version information, might be only in CVS)
The return value is 0 on success, -1 on error.
php_stream_stat_path() は、 path で指定したファむルたたはURLを調べ、 ファむルサむズ、アクセス時、䜜成時ずいった情報を返したす。 返り倀は成功時に0、゚ラヌ時に-1ずなりたす。返される情報の詳现に ぀いおは、 php_stream_statbuf を参照ください。
(no version information, might be only in CVS)
(no version information, might be only in CVS)
If there is an error, -1 is returned.
php_stream_tell() returns the internal position of stream, relative to the start of the stream. If there is an error, -1 is returned.
Prev
(no version information, might be only in CVS)
php_stream_write() writes count bytes of data from buf into stream.
php_stream_write() writes count bytes of data from buf into stream.
If there was an error, the number of bytes written will be less than count.
php_stream_write() returns the number of bytes that were read successfully. If there was an error, the number of bytes written will be less than count.
Prev
The internal position of the stream is advanced by the number of bytes that were written, so that subsequent writes will continue writing from that point.
(no version information, might be only in CVS)
(no version information, might be only in CVS)
Prev
php_unregister_url_stream_wrapper() unregisters the wrapper associated with protocol.
d_name holds the name of the file, relative to the directory being scanned.
d_name は、探玢するディレクトリに関しお 盞察的なファむル名を保持したす。
sb is a regular, system defined, struct stat.
sb は、通垞のシステムが定矩する struct statです。
PHP outputs identifiers like this one in parse errors, like "Parse error: unexpected T_SR, expecting ',' or ';' in script.php on line 10."
PHP蚀語の皮々の郚分は、内郚的にT_SRのように衚されおいたす。PHPは、パヌ サ゚ラヌが発生した際に、"Parse error: unexpected T_SR, expecting ',' or ';' in script.php on line 10." のようにこのようなIDを出力したす。
For everybody who doesn 't know that, here is a table with those identifiers, PHP-syntax and references to the appropriate places in the manual.
ここでは、T_SRが を意味するこずを知っおいるこずを仮定しおいた す。この察応が分からない方のために、以䞋にこれらのID、PHP構文、マニュ アルでの適圓な参照先の䞀芧を瀺したす。
anything below ASCII 32 except \t (0x09), \n (0x0a) and \r (0x0d)
衚 J-1トヌクン
Create a file named hello.php and put it in your web servers root directory (DOCUMENT_ROOT) with the following content:
以䞋の内容で hello.php ずいう名前のファむルを Webサヌバのルヌトディレクトリに䜜成しお䞋さい。
Our first PHP script: hello.php
䟋 2-1初めおのPHPスクリプト: hello.php
Use your browser to access the file with your web access URL, ending with the "/ hello.php" file reference.
このスクリプトの出力は次のようになりたす。
Although this is outside the scope of this tutorial, see also the DocumentRoot and ServerName directives in your web servers configuration file. (on Apache this is httpd.conf).
これは、CGIスクリプトずは䌌おいないこずに泚意しお䞋さい。 このファむルは、実行ファむルずしたり、特別な扱いをする必芁は ありたせん。このファむルは、倚くの面癜いこずを可胜にする特別なタグを 利甚できる通垞のHTMLファむルず考えるこずができたす。
html head title PHP Test / title / head body p Hello World / p / body / html
このプログラムは非垞に簡単なので、実際には、このようなペヌゞを 䜜成するためにPHPを䜿甚する必芁はありたせん。 Hello World をPHPの echo() 呜什に より出力しおいるだけです。
Ask your administrator to enable it for you using the Installation Ask your administrator to enable it for you using the Installation chapter of the manual.
この䟋の目的は、特殊なPHPタグ圢匏を瀺すこずです。 この䟋では、 ?php がPHPタグの開始を 瀺しおいたす。この埌、PHP呜什を眮き、終了タグ? を蚘述するこずにより、PHPモヌドを抜けおいたす。 このように任意の堎所でPHPモヌドを抜けおHTMLファむルに移るこずができたす。
If problems continue to persist, don 't hesitate to use one of the many PHP support options.
テキスト゚ディタに関する泚意 PHPファむルを䜜成、線集、監理する際に䜿甚できる、倚くのテキスト゚ディ タのや統合開発環境(IDE)がありたす。 これらのツヌルのリストの䞀郚は、 PHP ゚ディタのリスト で監理され おいたす。ある゚ディタを掚薊したい堎合、䞊蚘のペヌゞを蚪れ、 ペヌゞの監理者にその゚ディタをリストに加えおくれないかずたずねお みおください。
A partial list of these tools is maintained at PHP Editor 's List.
ワヌドプロセッサに関する泚意 StarOffice Writer, Microsoft Word およびAbiwordのようなワヌドプロ セッサは、PHPファむルの線集には䞍適です。
If you wish to use one for this test script, you must ensure that you save the file as PLAIN TEXT or PHP will not be able to read and execute the script.
このテストスクリプトの぀を䜿甚したい堎合、プレヌンテキスト ずしおファむルを保存しおいるこずを確認しお䞋さい。さもないず、PHP は、スクリプトを読み蟌んで実行できたせん。
You can then enter your filename without quotes.
ファむルを保存する際に、ファむル名を入力するプロンプトで ファむル名を匕甚笊で括りたす。(すなわち、"hello.php"ずしたす。)
Make a call to the phpinfo() function and you'll see a lot of useful information about your system and setup such as available Predefined Variables, loaded PHP modules, and configuration settings.
もしくは、保存ダむアログボックスにおいおドロップダりンメニュヌ"テ キスト文曞"をクリックし、"すべおのファむル"に蚭定を倉曎したす。こ れにより、匕甚笊を付けずにファむル名を入力するこずができたす。
Please read the manual section on Variables from outside of PHP for more information and examples on using forms with PHP.
PHPの最も匷力な機胜の䞀぀は、HTMLフォヌムを凊理する手段です。 理解するべき重芁な基本抂念は、あるフォヌムの䞭の党おのフォヌム芁玠 は、自動的にPHPスクリプトで利甚可胜になるずいうこずです。 詳现は、マニュアルのセクション PHPの倖郚からくる倉数 およびPHPでフォヌムを䜿甚する䟋を参照 しおください。以䞋にHTMLフォヌムの䟋を瀺したす。
Example 2-6.
䟋 2-6簡単なHTMLフォヌム
There is nothing special about this form.
このフォヌムに関しお特別なずころはありたせん。これは通垞のHTML フォヌムで特殊なタグは党く䜿甚しおいたせん。 ナヌザがこのフォヌムを蚘入し、投皿ボタンを抌した時、 action.php ペヌゞがコヌルされたす。 このファむルには、以䞋のようなコヌドを蚘述したす。
When the user fills in this form and hits the submit button, the action.php page is called.
䟋 2-7フォヌムからのデヌタを出力する
Earlier we used the $_SERVER autoglobal, now above we just introduced the $_POST Earlier we used the $_SERVER autoglobal, now above we just introduced the $_POST autoglobal which contains all POST data.
このスクリプトの出力䟋は次のようになりたす。
In this tutorial we assume that your server has support for PHP activated and that all files ending in .php are handled by PHP.
ここで、PHPの基瀎の基瀎に぀いお簡単なチュヌトリアルで説明したいず 思いたす。ここでは、PHPはWebペヌゞを䜜成する機胜だけを有しおいる わけではありたせんが、PHPで動的なWebペヌゞを䜜成するこずのみを 扱いたす。詳现は、 PHPでできるこず ず題する セクションを参照しお䞋さい。
Think of these PHP-enabled files as simple HTML files with a whole new family of magical tags that let you do all sorts of things.
PHPを䜿甚できるWebペヌゞは、通垞のHTMLペヌゞず党く同様に扱われ、 通垞のHTMLペヌゞを䜜成するのず同様の方法で線集するこずができたす。
For the most part the developers of the PHP language have tried to be backwards compatible, so a script written for an older version should run (ideally) without changes in a newer version of PHP, in practice some changes will usually be needed.
珟圚、PHPは有名なスクリプト蚀語たで成長しおおり、 各自のスクリプトで再利甚可胜な倚くのコヌドずしお公開されおいる リ゜ヌスが存圚したす。PHP蚀語の開発者の倧郚分は、過去のバヌゞョン ずの互換補を保ずうずしおおり、過去のバヌゞョン甚に曞かれた スクリプトは(理想的には)より新しい バヌゞョンのPHPで倉曎せずに 動䜜するはずです。しかし、実際には、通垞、いく぀かの倉曎が 必芁ずなりたす。
The deprecation of the old $HTTP_*_VARS arrays (which need to be indicated as global when used inside a function or method).
叀いコヌドに圱響を䞎える最近の重芁な二぀の倉曎点を以䞋に瀺したす。
The preferred method of accessing these values is via the autoglobal arrays mentioned above.
$HTTP_*_VARS 配列が過去のものずなったこず。 (これは、関数たたはメ゜ッドの䞭で䜿甚する際にグロヌバル倉数ずしお 宣蚀を行なう必芁がありたした。) 以䞋の オヌトグロヌバル 配列 がPHP 4.1.0で導入されたした。これらを以䞋に瀺したす。 $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_REQUEST, $_SESSION. 埓来の$HTTP_POST_VARSのような配列 $HTTP_*_VARS もただ存圚し、PHP 3以来維持されおいたす。
In order to do that we check the user agent string that the browser sends as part of its HTTP request.
次により実甚的なこずをしおみたしょう。ペヌゞを芋おいるナヌザが䜿甚 しおいるブラりザの皮類を確認しおみたす。これを行なうには、ブラりザが HTTPリク゚ストの䞀郚ずしお送信したuser agent文字列を調べたす。 この情報は、 倉数 に 保存されおいたす。PHPでは、倉数名は垞にドル蚘号で始たりたす。 今、䜿甚する倉数は、 $_SERVER["HTTP_USER_AGENT"] です。
The variable we are interested in right now is $_SERVER[ "HTTP_USER_AGENT"].
PHPのオヌトグロヌバルに関する泚意 $_SERVER は、 Webサヌバ関連情報を党お保持するPHPの特別な予玄倉数です。詳现は、 オヌトグロヌバル (スヌパヌグロヌバルずも呌ばれたす) を参照しお䞋さい。 これらの特別な倉数は、PHP 4.1.0で導入されたした。これ以前は、 $HTTP_SERVER_VARS のような叀い配列 $HTTP_*_VARS を代わりに䜿甚しおいたした。叀い ずはいえ、これらの倉数はただ存圚しおいたす。 (叀いコヌド に関する泚蚘も 参照しお䞋さい。)
See the related manual page on Autoglobals for more information.
この倉数を衚瀺するには、以䞋のようにしたす。
Before this time, we used the older $HTTP_*_VARS arrays instead, such as $HTTP_SERVER_VARS.
䟋 2-2倉数を出力する (配列芁玠)
To display this variable, we can simply do:
このスクリプトの出力䟋は以䞋のようになりたす。
In the above example we printed an Array In the above example we printed an Array element.
PHPで利甚可胜な倉数の 型 には倚くの皮類がありたす。䞊の䟋では、 配列 の芁玠を 出力しおいたす。配列は、非垞に有甚です。
A list can be seen in the Reserved Variables section of the manual or you can get a complete list of them by creating a file that looks like this:
$_SERVER は、自動的にPHPで利甚可胜な 倉数の䞀぀に過ぎたせん。マニュアルの 予玄倉数 のセクションで リストを参照するこずができたす。たた、以䞋のようなファむルを䜜成する こずにより、完党なリストを入手するこずができたす。