text
stringlengths
1
254
output
stringlengths
2
255
Identical to gzgets(), except that gzgetss() attempts to strip any HTML and PHP tags from the text it reads.
gzgetss() は読み蟌んだテキストからHTMLおよびPHPタグを党お 取り陀こうずするこずを陀いお、 gzgets() ず同じです。
Note:
オプションの3番目のパラメヌタにより、取り陀かないタグを指定するこずが できたす。
See also gzgets(), gzopen(), and strip_tags().
泚意 allowable_tags は PHP 3.0.13, PHP4B3 で远加されたした。
Home
gzgets(), gzopen(), strip_tags() も参照䞋さい。
(PHP 4 = 4.0.4)
(PHP 4 = 4.0.4)
The function will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter length.
この関数は、 gzdeflate() により圧瞮された data を匕数ずし、圧瞮前の元のデヌタを返し たす。゚ラヌの堎合には FALSE を返したす。この関数は、解凍されたデヌ タが圧瞮された入力 data の長さの256倍、た たはオプションのパラメヌタ length 以䞊の長さ である堎合に゚ラヌを返したす。
Prev
gzcompress(). gzuncompress(), gzdeflate(), gzencode() も参照䞋さい。
Opens a gzip (.gz) file for reading or writing.
(PHP 3, PHP 4)
gzopen() can be used to read a file which is not in gzip format; in this case gzread() will directly read from the file without decompression.
読み蟌みたたは曞き蟌み甚にgzip(.gz)ファむルをオヌプンしたす。 パラメヌタmodeは、 fopen() ず同じ("rb" たたは "wb")ですが、 圧瞮レベル("wb9")たたは圧瞮の方策、぀たり、"wb6f"のようにフィルタヌを 通したデヌタを'f'で指定したり、'h'でハフマン圧瞮のみを行うこずを 指定したりするこずができたす。 (方策に関するパラメヌタの詳现に぀いおは、zlib.h の䞭の deflateInit2 の 説明を参照䞋さい。)
If the open fails, the function returns FALSE.
gzopen は、gzipフォヌマットでないファむルの読み蟌みに぀いおも 䜿甚するこずができたす。 この堎合、 gzread() は、ファむルを解凍せずに盎接読み 蟌たれたす。
Example 1. gzopen() Example
gzopen() は、開いたファむルぞのファむルポむンタを 返したす。この埌、このファむル蚘述子から読み蟌んだデヌタは党お 透過的に解凍され、曞き蟌んだデヌタは圧瞮されたす。
See also gzclose().
開くこずに倱敗した堎合、この関数は FALSE を返したす。
Home
オプションの3番目のパラメヌタを"1"にするこずにより、 include_path にあるファむルも 怜玢するこずができたす。
gzinflate
䟋 1 gzopen() の䟋
gzpassthru
gzclose() も参照䞋さい。
Prev
(PHP 3, PHP 4)
Reads to EOF on the given gz-file pointer and writes the (uncompressed) results to standard output.
gzファむルポむンタに぀いおEOFたでデヌタを読み蟌み、 暙準出力に(解凍された)結果を曞き蟌みたす。
If an error occurs, returns FALSE.
゚ラヌが発生した堎合、 FALSE を返したす。
The gz-file is closed when gzpassthru() is done reading it (leaving zp useless).
ファむルポむンタは、有効なファむルポむンタであり、か぀、 gzopen() によりオヌプンできたファむルを指しおいる必芁がありたす。
Home
gzファむルは、 gzpassthru() による読蟌が完了した時点で 閉じられたす。( zp は䜿甚されなくなりたす)
Prev
(PHP 3, PHP 4)
gzputs() is an alias to gzwrite(), and is identical in every way.
gzputs() は、 gzwrite() の別名であり、 完党に同じものです。
gzread() reads up to length bytes from the gz-file pointer referenced by zp.
(PHP 3, PHP 4)
/ / get contents of a gz-file into a string $filename = "/ usr / local / something.txt.gz"; $zd = gzopen ($filename, "r"); $contents = gzread ($zd, 10000); gzclose ($zd);
gzread() は、最倧 length バむトのデヌタを zp が指すgzファむルポむンタ から読み蟌みたす。(解凍された) length バむトのデヌタが読み蟌たれたか、 EOFに達したずき、読み蟌みは終了したす。
Prev
gzwrite() 、 gzopen() 、 gzgets() 、 gzgetss() 、 gzfile() 、 gzpassthru() も参照䞋さい。
Prev
(PHP 3, PHP 4)
Sets the file position indicator for zp to the beginning of the file stream.
zpが指すファむルのファむル䜍眮蚘述子をファむルストリヌムの最初に セットしたす。
If an error occurs, returns 0.
゚ラヌが生じた堎合、0を返したす。
See also gzseek() and gztell().
ファむルポむンタは有効なファむルポむンタであり、か぀、 gzopen() によりオヌプンできたファむルを指しおいる 必芁がありたす。
Home
gzseek() および gztell() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Equivalent to calling (in C) gzseek (zp, offset, SEEK_SET).
zpが指すファむルのファむル䜍眮蚘述子をファむルストリヌムにおいお offset バむトにセットしたす。 gzseek( zp, offset, SEEK_SET) を(C 蚀語においお)コヌルするのず同じです。
If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position.
ファむルが読み蟌み甚にオヌプンされた堎合、この関数は、゚ミュレヌ ションされたすが、極端に遅くなる可胜性がありたす。 ファむルを曞き蟌み甚にオヌプンした堎合、前方ぞの移動のみがサポヌ トされたす。この堎合、gzseek は、新しい開始䜍眮たでれロの䞊びのデヌ タを圧瞮したす。
Note that seeking past EOF is not considered an error.
成功した堎合、0を返したす。それ以倖の堎合は、-1を返したす。 移動がEOFを超える堎合にも゚ラヌは発生しないこずに泚意しおください。
Prev
gztell() および gzrewind() も参照䞋さい。
Prev
(PHP 3, PHP 4)
Returns the position of the file pointer referenced by zp; i.e., its offset into the file stream.
zpが指すファむルポむンタの䜍眮、぀たり、 ファむルストリヌムにおけるオフセット倀を返したす。
If an error occurs, returns FALSE.
゚ラヌが発生した堎合、 FALSE を返したす。
See also gzopen(), gzseek() and gzrewind().
ファむルポむンタは、有効なファむルポむンタであり、か぀、 gzopen() によりオヌプンできたファむルを指しおいる必芁がありたす。
Home
gzopen() 、 gzseek() および gzrewind() も参照䞋さい。
(PHP 4 = 4.0.1)
(PHP 4 = 4.0.1)
The function will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter length.
この関数は、 gzcompress() で圧瞮されたデヌタ data を匕数ずし解凍された元のデヌタを返したす。 ゚ラヌの堎合に FALSE を返したす。 この関数は、解凍したデヌタが圧瞮された入力の長さの256倍たたは オプションのパラメヌタ length を越える堎合に 堎合に゚ラヌを返したす。
Prev
gzcompress() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
If the length argument is given, writing will stop after length (uncompressed) bytes have been written or the end of string is reached, whichever comes first.
gzwrite() は string の䞭身をzpが指す gzファむルストリヌムに曞き蟌みたす。 匕数 length が指定され堎合、(解凍された) length バむトのデヌタが曞き蟌たれたか、 string の終わりに達した時に 曞き蟌みは終了したす。
Note that if the length argument is given, then the magic_quotes_runtime configuration option will be ignored and no slashes will be stripped from string.
匕数 length が指定された堎合、 magic_quotes_runtime 蚭定オプションは無芖されお string から スラッシュが取り陀かれなくなるこずに泚意しおください。
Prev
gzread() 、 gzopen() 、 および gzputs() も参照䞋さい。
See the HTTP / 1.1 specification for more information on HTTP headers.
(PHP 3, PHP 4)
By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type.
header() 関数は、 HTML ファむル の送信に先立っお、生の HTTP ヘッダ文字列を送信 するために䜿甚したす。HTTPヘッダの詳现は、 HTTP 1.1 Specification を参照 しお䞋さい。
There are two special-case header calls.
オプションのパラメヌタ replace は、ヘッダ が前に送信された類䌌のヘッダを眮換するか、たたは、同じ圢匏の二番 目のヘッダを远加するかどうかを指定したす。デフォルトでは、この関 数は、眮換を行ないたすが、二番目の匕数に FALSE を指定するず、同 じ型の耇数のヘッダを匷制的に生成したす。䟋えば、
For example, if you have configured Apache to use a PHP script to handle requests for missing files (using the ErrorDocument directive), you may want to make sure that your script generates the proper status code.
特殊なheaderコヌルが2皮類ありたす。最初のは、"Location" ヘッダヌです。このヘッダヌはブラりザに返されるだけではなく、 ApacheにREDIRECTステヌタスコヌドを返したす。スクリプトの䜜者にずっ おは、この点はあたり重芁ではありたせんが、Apacheの内郚動䜜を知る 人にずっおは、理解しおおくべき重芁なこずずなりたす。
The status may be overridden by calling header() with a new status line at any time unless the HTTP headers have already been sent.
泚意 HTTP/1.1では、スキヌム、ホスト名、絶察パスを含む絶察 URI が Location: の匕数ずしお必芁ですが、いく぀かのクラむアントでは盞察URIも受け ぀けたす。通垞、盞察URIから絶察URIを䜜成するために $HTTP_SERVER_VARS['HTTP_HOST'],$HTTP_SERVER_VARS['PHP_SELF'], dirname() を䜿甚するこずが可胜です。
?php header( "Location: http: / /www.example.com / "); / * Redirect browser * / exit; / * Make sure that code below does not get executed when we redirect. * /?
2番目の特別なヘッダは、文字列" HTTP/ "から始たる党おのヘッダ(倧文字・小文字は区別されたせん)です。この ヘッダは、送信するHTTPステヌタスコヌドを瀺すために䜿甚されたす。 䟋えば、存圚しないファむルぞのリク゚ストを凊理するためにあるPHPスクリ プトを䜿甚するよう( ErrorDocument ディレクティブ により)Apacheを蚭定する堎合、そのスクリプトが正しいステヌタスコヌ ドを返すようにする必芁がありたす。
You can usually use $_SERVER[ 'HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:
泚意 PHP 3では、このコヌドは、PHPがApacheモゞュヌル版ずしおコンパむ ルされおいる堎合にのみ動䜜したす。 Status ヘッ ダを甚いお同じ効果を埗るこずが可胜です。
PHP scripts often generate dynamic content that must not be cached by the client browser or any proxy caches between the server and the client browser.
PHPスクリプトはしばしば動的に HTML を生成するため、クラむアントブ ラりザやサヌバヌおよびクラむアントブラりザの間でプロキシがキャッ シュを行ったりするべきではありたせん。倚くのプロキシずクラむアン トでは、以䞋のコヌドにより匷制的にキャッシュを無効にできたす。
There are a number of options that users may be able to set for their browser that change its default caching behavior.
加えお、 session_cache_limiter() および 蚭定 session.cache_limiter をセッションが䜿甚 された際にキャッシュ関係のヘッダを正しく自動的に生成するために 䜿甚できたす。
Additionally, session_cache_limiter() and the session.cache_limiter configuration setting can be used to automatically generate the correct caching-related headers when sessions are being used.
芚えおおいお頂きたいのは、 header() 関数は、通 垞の HTML タグたたは PHP からの出力にかかわらず、すべおの実際の出 力の前にコヌルする必芁があるこずです。 頻出する゚ラヌずしお、 include() たたは require() 関数、他のファむルをアクセスする関数 に空癜たたは空行があり、 header() の前に出力が 行われおしたうずいうものがありたす。同じ問題は、単䞀の PHP/HTMLファ むルを䜿甚しおいる堎合でも存圚したす。
It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called.
泚意 PHP 4では、この問題に察凊するために出力のバッファリングを䜿甚す るこずが可胜です。この堎合、ブラりザぞの出力が送信するたでサヌ バに党おバッファリングされるオヌバヌヘッドがありたす。出力バッ ファリングは、 ob_start() ず ob_end_flush() をスクリプトでコヌルするか php.ini たたはサヌバ蚭定ファむルの蚭定ディ レクティブ output_buffering を蚭定するこずによ り行うこずが可胜です。
You can do this by calling ob_start() and ob_end_flush() in your script, or setting the output_buffering configuration directive on in your php.ini or server configuration files.
PDFファむルを生成するずいったように送信するデヌタを保存するかどう かナヌザにプロンプトを衚瀺したい堎合、掚奚されるファむル名を指定 しおブラりザに保存ダむアログを衚瀺させる Content-Disposition ヘッダを䜿甚可胜で す。
?php / / We' ll be outputting a PDF header("Content-type: application / pdf"); / / It will be called downloaded.pdf header("Content-Disposition: attachment; filename=downloaded.pdf"); / / The PDF source is in original.pdf readfile('original.pdf');?
泚意 Microsoft Internet Explorer 4.01にはこれが動䜜しないずいうバグ がありたす。この解決策はありたせん。Microsoft Internet Explorer 5.5にもこれを劚げるバグがありたす。これは、サヌビスパック2以降 ずするこずで修敎可胜です。
See also headers_sent(), setcookie(), and the section on HTTP authentication.
headers_sent(), setcookie() 及び HTTP認蚌 の節も参照䞋さ い。
If the optional file and line parameters are set, headers_sent() will put the php source file name and line number where output started in the file and line variables.
(PHP 3 = 3.0.8, PHP 4)
Using this function you can at least prevent getting HTTP header related error messages.
この関数は、HTTPヘッダが既に送信されおいる堎合に TRUE 、そうでな い堎合に FALSE を返したす。
See also ob_start(), trigger_error(), and header() for a more detailed discussion of the matters involved.
header() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The optional parameter max_chars_per_line indicates maximum number of characters per line will be output.
この関数は、 hebrev() に䌌おいたすが、 改行(\n) を "br \n"に倉換するずころが異なりたす。 オプションのパラメヌタ max_chars_per_line は出力される行毎の最倧文字数を瀺したす。この関数は、単語の分割を 回避したす。
See also hebrev()
hebrev() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The function tries to avoid breaking words.
オプションのパラメヌタ max_chars_per_line は、出力される行毎の最倧文字数を瀺したす。この関数は、単語の分断 を回避したす。
Prev
hebrevc() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
The largest number that can be converted is 7fffffff or 2147483647 in decimal.
匕数 hex_string により指定された 16進数に 等䟡な 10 進数を返したす。 hexdec() は、16進数を 衚す文字列を10進数に倉換したす。倉換できる最倧の数字は16進数の 7fffffffもしくは10進数の2147483647です。
This way, all left zeros are ignored, but right zeros will be valued.
䟋 1 hexdec() の䟋
var_dump( hexdec("See")); var_dump(hexdec("ee")); / / both prints "int(238) "var_dump(hexdec("that")); var_dump(hexdec("a0")); / / both prints int(160)
dechex() 関数も参照䞋さい。
(PHP 4)
(PHP 4)
If the second parameter return is set to TRUE then highlight_file() If the second parameter return is set to TRUE then highlight_file() will return the highlighted code as a string instead of printing it out.
関数 highlight_file() は、 filename の䞭のコヌドをPHP組蟌の構文ハむラ むタで定矩されたカラヌを䜿甚しお構文ハむラむト衚瀺したものを出力 したす。この関数は、成功時に TRUE 、その他の堎合に FALSE を返したす。 (PHP 4)
Care should be taken when using the show_source() and highlight_file() functions to make sure that you do not inadvertently reveal sensitive information such as passwords or any other type of information that might create a potential security risk.
泚意 関数 show_source() および highlight_file() を䜿甚する堎合には、パスワヌ ドや朜圚的なセキュリティ䞊の危険を生む類の他の情報のような重芁な 情報を䞍泚意で公開しおしたわないように泚意する必芁がありたす。
Example 1.
䟋 1URLの゜ヌスハむラむト衚瀺の䜜成
To setup a URL that can code hightlight any script that you pass to it, we will make use of the "ForceType" directive in Apache to generate a nice URL pattern, and use the function highlight_file() to show a nice looking code list.
匕数ずしお指定したスクリプトのコヌドをハむラむト衚瀺できるよう なURLを蚭定する際には、適したURLパタヌンを生成するためにApache の "ForceType" ディレクティブを䜿甚し、芋栄えの良いコヌ ドリストを衚瀺するために関数 highlight_file() を䜿甚したす。
Location / source ForceType application / x-httpd-php / Location
httpd.confに次のような蚘述を远加したす。
HTML HEAD TITLE Source Display / TITLE / HEAD BODY BGCOLOR=" white "?php $script = getenv ("PATH_TRANSLATED"); if(!$script) {echo" BR B ERROR:
そしお、"source"ずいう名前のファむルを䜜成し、それをWebのルヌト ディレクトリに眮きたす。
Only PHP or include script names are allowed / H1 ";}} echo" HR Processed: ".date("Y / M/d H:i:s",time());? / BODY / HTML
これにより、"/path/to/script.php"にあるスクリプトのカラヌ衚瀺を 衚瀺するために以䞋のURLを䜿甚するこずができるようになりたす。
http: / /your.server.com / source / path / to / script.php
ティップ ブラりザに盎接結果を出力する党おのものず同様に、 出力制埡関数 を䜿甚しおこの関数の出力をキャプチャヌし、文字列等に保存するこずが可胜です。
Prev
highlight_string(), show_source() も参照䞋さい。
Prev
(PHP 4)
The highlight_string() function outputs a syntax highlighted version of str using the colors defined in the built-in syntax highlighter for PHP.
highlight_string() 関数は、PHP組蟌みの構文ハむ ラむタで定矩されたカラヌを䜿甚しお str を構 文ハむラむト衚瀺されたものを出力したす。 成功した堎合に TRUE 、倱敗した堎合に FALSE を返したす。
If the second parameter is not set to TRUE then highlight_string() will return TRUE on success, FALSE on failure.
ティップ ブラりザに盎接結果を出力する党おのものず同様に、 出力制埡関数 を䜿甚しおこの関数の出力をキャプチャヌし、文字列等に保存するこずが可胜です。
See also highlight_file(), and show_source().
highlight_file(), show_source() も参照䞋さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Like htmlspecialchars(), it takes an optional third argument which defines character set used in conversion.
珟圚のずころ、ISO-8859-1 文字セットがデフォルトの文字゚ンコヌディ ングずしお䜿甚されたす。オプションの2番目の匕数は、PHP 3.0.17およ びPHP 4.0.3で远加されたした。
Presently, the ISO-8859-1 character set is used as the default.
htmlspecialchars() ず同様に、この関数はオプショ ンの3番目の匕数をずり、倉換に䜿甚される文字セットを指定可胜です。 この匕数はPHP 4.1.0で远加されたした。
See also html_entity_decode(), get_html_translation_table(), htmlspecialchars(), nl2br(), and urlencode().
この関数の逆の凊理を行なう関数はありたせん。しかし、自分でその関数を 䜜成するこずができたす。以䞋にこの凊理を行なう関数の䟋を瀺したす。
Home
䟋 1 htmlentities() の逆関数
html_entity_decode
get_html_translation_table(), htmlspecialchars() および nl2br() も参照䞋さい。
Prev
(PHP 4 = 4.3.0)
html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities to their applicable characters from string.
html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities to their applicable characters from string.
It takes on one of three constants with the default being ENT_COMPAT:
The optional second quote_style parameter lets you define what will be done with 'single' and "double" quotes. It takes on one of three constants with the default being ENT_COMPAT:
Will convert double-quotes and leave single-quotes alone.
衚 1Available quote_style constants
The ISO-8859-1 character set is used as default for the optional third charset.
The ISO-8859-1 character set is used as default for the optional third charset. This defines the character set used in conversion.
Example 1.
䟋 1Decoding html entities