text
stringlengths 1
254
| output
stringlengths 2
255
|
---|---|
To release a lock (shared or exclusive), set operation to LOCK_UN (set to 3 prior to PHP 4.0.1).
|
å
±æããã¯(èªã¿æ)ãšããã«ã¯ã operation ã« LOCK_SH(PHP 4.0.1ããåã®å Žåã¯1ã«èšå®ããŸã)ãã»ããããŸãã
|
If you don' t want flock() to block while locking, add LOCK_NB (4 prior to PHP 4.0.1) to operation.
|
æä»çããã¯(æžãæ)ãšããã«ã¯ã operation ã«LOCK_EX(PHP 4.0.1ããåã®å Ž åã¯2ã«èšå®ããŸã)ãã»ããããŸãã
|
flock() allows you to perform a simple reader / writer model which can be used on virtually every platform (including most Unix derivatives and even Windows).
|
(å
±æãŸãã¯æä»ç)ããã¯ãéæŸããã«ã¯ã operation ã«LOCK_UN(PHP 4.0.1ããåã®å Ž åã¯3ã«èšå®ããŸã)ãã»ããããŸãã
|
Returns TRUE on success or FALSE on failure.
|
ããã¯äžã« flock() ã§ãããã¯ãè¡ããããªãå Ž åã¯ã operation ã« LOCK_NB (PHP 4.0.1 ããåã®å Žå㯠4 ã«èšå®ããŸã)ãå ããŸãã
|
Warning
|
flock() ã«ããã(ã»ãšãã©ã®UNIXãWindowsããå«ã) ã»ãšãã©å
šãŠã®ãã©ãããã©ãŒã ã§äœ¿çšå¯èœãªç°¡æãªèªã¿æ/æžãæã¢ã ã«ãå®çŸãããŸããããã¯ããããã¯ã¢ãŒããšããå Žå(EWOULDBLOCK errno æ¡ä»¶)ã«ãªãã·ã§ã³ã®3çªç®ã®åŒæ°ã« TRUE ãèšå®ããŸãã
|
Check your operating system documentation for more details.
|
flock() ã¯æåæã« TRUE ã (äŸãã°ããã¯ã確ä¿ã§ããªãã£ãå Žåçã®)ãšã©ãŒæã« FALSE ãè¿ããŸãã
|
When using a multithreaded server API like ISAPI you may not be able to rely on flock() to protect files against other PHP scripts running in parallel threads of the same server instance!
|
泚æ flock() ã¯ããã¡ã€ã«ãã€ã³ã¿ãå¿
èŠãšããããã (fopen() ãžåŒæ°"w"ãŸãã¯"w+"ãæå®ããŠ)æžã蟌 ã¿ã¢ãŒãã§ãªãŒãã³ããããšã«ããäžžãããã¡ã€ã«ã«ã¢ã¯ã»ã¹ä¿è·ãã ç¹å¥ãªããã¯ãã¡ã€ã«ã䜿çšããå¿
èŠããããããããŸããã
|
Prev
|
flock() ã¯NFSåã³ä»ã®å€ãã®ãããã¯ãŒã¯ãã¡ã€ ã«ã·ã¹ãã ã§ã¯åäœããŸããã詳现ã«ã€ããŠã¯ãªãã¬ãŒãã£ã³ã°ã·ã¹ã ã ã®ããã¥ã¡ã³ãã確èªäžããã
|
filetype
|
ããã€ãã®ãªãŒãã¬ãŒãã£ã³ã°ã·ã¹ãã ã§ flock() ã¯ããã»ã¹ã¬ãã«ã§å®è£
ãããŠããŸããISAPIã®ãããªãã«ãã¹ã¬ãã åã®ãµãŒããŒAPIã䜿çšããŠããå ŽåãåããµãŒããŒã€ã³ã¹ã¿ã³ã¹ã®äžŠ åã¹ã¬ããã§å®è¡ãããŠããä»ã®PHPã¹ã¯ãªããã«å¯ŸããŠãã¡ã€ã«ãä¿ è·ããéã« flock() ã䜿çšããããšã¯ã§ããŸãã!
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
The return value of floor() is still of type float because the value range of float is usually bigger than that of integer.
|
å¿
èŠã«å¿ã㊠value ãäžžããããšã«ãããæã è¿ãæå°ã®æŽæ°ã®å€ãè¿ããŸãã floor() ã®è¿ãå€ ã¯ã float åã®ãŸãŸãšãªããŸããããã¯ã float ã®ç¯å²ã¯ int ãããåºãããã§ãã
|
echo floor( 4.3); / / 4 echo floor(9.999); / / 9
|
äŸ 1 floor() ã®äŸ
|
Prev
|
ceil() ãš round() ãåç
§äž ããã
|
Prev
|
(PHP 3, PHP 4)
|
Flushes the output buffers of PHP and whatever backend PHP is using (CGI, a web server, etc).
|
PHPããã³PHPã䜿ã£ãŠãã(CGI, Web ãµãŒããªã©ã®)ããã¯ãšã³ã ã®åºåãããã¡ããã©ãã·ã¥ããŸããããã«ããããããŸã§ã®å
šãŠã® åºåããŠãŒã¶ã®ãã©ãŠã¶ã«å¯ŸããŠå¹ççã«åºåãããŸãã
|
Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser.
|
泚æ flush() ã¯ãWebãµãŒããŸãã¯ã¯ã©ã€ã¢ã³ãåŽã®ã ã©ãŠã¶ã®ãããã¡ãªã³ã°ã®ææ³ã«åœ±é¿ãäžããŸããã
|
Server modules for Apache like mod_gzip may do buffering of their own that will cause flush() to not result in data being sent immediately to the client.
|
è€æ°ã®ãµãŒããç¹ã« Win32 äžã§ã¯ã¹ã¯ãªããããã®åºåããã©ãŠã¶ã« çµæãéä¿¡ããåã«ã¹ã¯ãªãããçµäºãããŸã§ãããã¡ã«æºããããšã ãããŸãã
|
Netscape, for example, buffers text until it receives an end-of-line or the beginning of a tag, and it won 't render tables until the / table tag of the outermost table is seen.
|
ãã©ãŠã¶åŽã§è¡šç€ºåã«å
¥åããããã¡ãªã³ã°ããããšãããåŸãŸãã Netscape ã§ã¯äŸãã°æ¹è¡ãŸãã¯éå§ã¿ã°ãåä¿¡ãããŸã§ããã¹ãã¯ãã ãã¡ãªã³ã°ãããæãå€åŽã®ããŒãã«ã® /table ã¿ã°ãçŸãã ãŸã§ããŒãã«ã¯æç»ãããŸããã
|
Prev
|
ããã€ãã®ããŒãžã§ã³ã®Microsoft Internet Explorerã¯ã256ãã€ãã® åºåãåããŠããããŒãžã衚瀺ãå§ããŸãããã®ããããããã®ãã©ãŠ ã¶ã«ããŒãžã衚瀺ãããã«ã¯ããã©ãã·ã¥ããåã«äœåãªç©ºçœãéä¿¡ã ãå¿
èŠããããããããŸããã
|
Returns the floating point remainder of dividing the dividend (x) by the divisor (y).
|
(PHP 4 = 4.2.0)
|
If y is non-zero, r has the same sign as x and a magnitude less than the magnitude of y.
|
Returns the floating point remainder of dividing the dividend (x) by the divisor (y). The reminder (r) is defined as: x = i * y + r, for some integer i. If y is non-zero, r has the same sign as x and a magnitude less than the magnitude of y.
|
$x = 5.7; $y = 1.3; $r = fmod($x, $y); / / $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7
|
äŸ 1Using fmod()
|
Prev
|
(PHP 4 = 4.3.0)
|
fnmatch() checks if the passed string would match the given shell wildcard pattern.
|
fnmatch() checks if the passed string would match the given shell wildcard pattern.
|
Checking a color name against a shell wildcard pattern.
|
äŸ 1 Checking a color name against a shell wildcard pattern.
|
See also glob(), ereg(), preg_match() and the unix manpage on fnmatch(3) for flag names (as long as they are not documented here).
|
See also glob(), ereg(), preg_match() and the unix manpage on fnmatch(3) for flag names (as long as they are not documented here).
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
If filename is of the form "scheme: / /.. .", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme.
|
filename ã"http://"(倧æåå°æåã¯åºå¥ããŸãã) ã§å§ãŸã£ãŠããå Žåãæå®ããããµãŒãã«å¯ŸããHTTP 1.0ã³ãã¯ã·ã§ã³ã ãªãŒãã³ãããHTTPãGETã¡ãœãããçšããŠãã®ããŒãžããªã¯ãšã¹ãããã è¿ãããå¿çã®æ¬äœã®å
é ãæããã¡ã€ã«ãã€ã³ã¿ãè¿ãããŸãã ååã«åºã¥ãä»®æ³ãã¹ããåŠçããããã«'Host:' ããããããªã¯ãšã¹ãã§ éä¿¡ãããŸãã
|
If PHP has decided that filename specifies a local file, then it will try to open a stream on that file.
|
ãã¡ã€ã«ãã€ã³ã¿ã«ããã¬ã¹ãã³ã¹ã® æ¬äœ ã®ã¿ã ååŸããããšãå¯èœã§ããããšã«æ³šæããŠäžããããã®é¢æ°ãçšã㊠HTTPã¬ã¹ãã³ã¹ã«ã¢ã¯ã»ã¹ããããšã¯ã§ããŸããã
|
If you have enabled safe_mode, or open_basedir further restrictions may apply.
|
PHP 4.0.5 ããåã®ããŒãžã§ã³ã¯ãHTTPãªãã€ã¬ã¯ããåŠçããŸããã§ã ãããã®ããããã£ã¬ã¯ããªã¯æ«å°Ÿã«ã¹ã©ãã·ã¥ãå«ãå¿
èŠããããŸããã
|
If it is switched off, PHP will emit a warning and the fopen call will fail.
|
filename ã"ftp://"(倧æåå°æåã¯åºå¥ããŸãã) ã§å§ãŸã£ãŠããå Žåãæå®ããããµãŒãã«å¯Ÿãã FTPã³ãã¯ã·ã§ã³ããªãŒãã³ãããèŠæ±ãããã¡ã€ã«ãžã®ãã€ã³ã¿ã è¿ãããŸãããã®ãµãŒããããã·ãã»ã¢ãŒãFTPããµããŒãã㊠ããªãå Žåã¯ããã®é¢æ°ã¯å€±æããŸãã ftpçµç±ã§èªã¿ãã¿ãŸãã¯æžããã¿ã®ã©ã¡ããã§ãã¡ã€ã«ãªãŒãã³ãã ããšãå¯èœã§ãã(ããããåæã«äž¡æ¹ãè¡ãããšã¯ã§ããŸããã)
|
mode specifies the type of access you require to the stream.
|
filename ã"php://stdin","php://stdout", "php://stderr"ã®ã©ããã§å§ãŸã£ãŠããå Žåã察å¿ããstdioã¹ããªãŒã ã ãªãŒãã³ãããŸãã (ãã®æ©èœã¯PHP 3.0.13ã§å°å
¥ãããŸããããã以åã®ããŒãžã§ã³ã§ã¯ã stdioã¹ããªãŒã ã«ã¢ã¯ã»ã¹ããããã« "/dev/stdin"ãŸãã¯"/dev/fd/0"ã®ãããªãã¡ã€ã«åã䜿çšããå¿
èŠããããŸãã)
|
'r+' - Open for reading and writing; place the file pointer at the beginning of the file.
|
filename ãäžèšä»¥å€ã®å Žåãæå®ããã ãã¡ã€ã«ããã¡ã€ã«ã·ã¹ãã ãããªãŒãã³ããããã®ãªãŒãã³ããã ãã¡ã€ã«ãžã®ãã¡ã€ã«ãã€ã³ã¿ãè¿ãããŸãã
|
'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length.
|
ãªãŒãã³ã«å€±æãããšããã®é¢æ°ã¯ FALSE ãè¿ããŸãã
|
If the file does not exist, attempt to create it.
|
mode ã¯æ¬¡ã®ã©ããã«ãªããŸãã
|
If the file does not exist, attempt to create it.
|
'r' - èªã¿ãã¿ã®ã¿ã§ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ããã¡ã€ã«ã® å
é ã«çœ®ããŸãã
|
If the file does not exist, attempt to create it.
|
'r+' - èªã¿ãã¿ã»æžããã¿çšã«ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ã ãã¡ã€ã«ã®å
é ã«çœ®ããŸãã
|
If the file does not exist, attempt to create it.
|
'w' - æžããã¿ã®ã¿ã§ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ããã¡ã€ã«ã® å
é ã«çœ®ãããã¡ã€ã«ãµã€ãºããŒãã«ããŸãããã¡ã€ã«ãååšããªã å Žåã«ã¯ãäœæã詊ã¿ãŸãã
|
This is useful only on systems which differentiate between binary and text files (i.e.
|
'w+' - èªã¿ãã¿ã»æžããã¿çšã§ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ã ãã¡ã€ã«ã®å
é ã«çœ®ãããã¡ã€ã«ãµã€ãºããŒãã«ããŸãã ãã¡ã€ã«ãååšããªãå Žåã«ã¯ãäœæã詊ã¿ãŸãã
|
If not needed, this will be ignored.
|
'a' - æžããã¿ã®ã¿ã§ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ããã¡ã€ã«ã® çµç«¯ã«çœ®ããŸãããã¡ã€ã«ãååšããªãå Žåã«ã¯ãäœæã詊ã¿ãŸãã
|
The optional third use_include_path parameter can be set to '1' or TRUE if you want to search for the file in the include_path, too.
|
'a+' - èªã¿ãã¿ã»æžããã¿çšã§ãªãŒãã³ããŸãããã¡ã€ã«ãã€ã³ã¿ã ãã¡ã€ã«ã®çµç«¯ã«çœ®ããŸãããã¡ã€ã«ãååšããªãå Žåã«ã¯ãäœæã 詊ã¿ãŸãã
|
If the open fails, the function returns FALSE.
|
ãªãã·ã§ã³ã®2çªç®ã®åŒæ°ã䜿çšããŠãããã«"1"ãèšå®ãã ããšã«ããã include_path ã®ãã¡ã€ã«ã®æ€çŽ¢ãè¡ãããšãã§ããŸãã
|
Example 1. fopen() example
|
äŸ 1 fopen() ã®äŸ
|
If you are experiencing problems with reading and writing to files and you' re using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process.
|
ãã¡ã€ã«ã®èªã¿ãã¿ã»æžããã¿æã«åé¡ãçºçãã ãµãŒããŒã¢ãžã¥ãŒã«çã®PHPã䜿çšããŠããå Žåã 䜿çšãããã¡ã€ã«ã»ãã£ã¬ã¯ããªããµãŒããŒããã»ã¹ããã¢ã¯ã»ã¹å¯èœ ãã©ããã確èªããŠã¿ãŠãã ããã
|
?php $handle = fopen ("c:\\data\\info.txt", "r");?
|
Windows ç°å¢ã§ã¯ããã¡ã€ã«ãã¹ã§çšããå
šãŠã®ããã¯ã¹ã©ãã·ã¥ã ãšã¹ã±ãŒãããããã©ã¯ãŒãã¹ã©ãã·ã¥ã䜿çšããããšã«æ³šæããŠäžããã
|
Prev
|
fclose(), fsockopen(), socket_set_timeout(), popen() ãåç
§äžããã
|
Prev
|
(PHP 3, PHP 4)
|
Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.
|
äžãããããã¡ã€ã«ãã€ã³ã¿ãEOFãŸã§èªã¿ãçµæãæšæºåºåã«æžãåºã ãŸãã
|
Otherwise, fpassthru() returns the number of characters read from handle and passed through to the output.
|
ãšã©ãŒãèµ·ãã£ãå Žåã fpassthru() 㯠FALSE ãè¿ããŸãã
|
You may need to call rewind() You may need to call rewind() to reset the file pointer to the beginning of the file if you have already written data to the file.
|
ãã¡ã€ã«ãã€ã³ã¿ã¯æå¹ãªãã®ã§ãªããã°ãªããããŸã fopen(), popen() ãŸã㯠fsockopen() ã§æ£åžžã«ãªãŒãã³ããããã¡ã€ã«ãæããŠããå¿
èŠããããŸãã fpassthru() ã¯ãã¡ã€ã«ãèªã¿çµãããš ãã®ãã¡ã€ã«ãã¯ããŒãºããŸãïŒæ®ã£ã fp ã¯ãã¯ã䜿çšã§ããŸããïŒã
|
If you just want to dump the contents of a file to the output buffer, without first modifying it or seeking to a particular offset, you may want to use the readfile(), which saves you the fopen() call.
|
ãã¡ã€ã«ã®å
å®¹ãæšæºåºåã«ãã³ããããã ãã®å Žåã readfile() ã䜿çšããããšãå¯èœã§ãã ãã®å Žåã fopen() ã³ãŒã«ã¯å¿
èŠãããŸããã
|
You are encouraged to use the b flag when dealing with binary files, even if your system does not require it, so that your scripts will be more portable.
|
泚æ fpassthru() ãWindowsã·ã¹ãã ã®ãã€ããªãã¡ã€ ã«ã§äœ¿çšããå Žåã fopen() ãã³ãŒã«ããéã« ã¢ãŒãã« b ã远å ããŠãã€ããªã¢ãŒãã§ãã¡ã€ã«ã ãªãŒãã³ããããã«ããŠäžããã
|
Prev
|
readfile(), fopen(), popen(), fsockopen() ãåç
§äžããã
|
Write a string produced according to the formatting string format to the stream resource specified by handle..
|
(PHP 5 CVS only)
|
This applies to fprintf(), sprintf(), and printf().
|
Write a string produced according to the formatting string format to the stream resource specified by handle..
|
The default is right-justified; a - character here will make it left-justified.
|
Each conversion specification consists of a percent sign (%), followed by one or more of these elements, in order:
|
A type specifier that says what type the argument data should be treated as.
|
An optional alignment specifier that says if the result should be left-justified or right-justified. The default is right-justified; a - character here will make it left-justified.
|
c - the argument is treated as an integer, and presented as the character with that ASCII value.
|
An optional number, a width specifier that says how many characters (minimum) this conversion should result in.
|
u - the argument is treated as an integer, and presented as an unsigned decimal number.
|
An optional precision specifier that says how many decimal digits should be displayed for floating-point numbers. This option has no effect for other types than float. (Another function useful for formatting numbers is number_format().)
|
o - the argument is treated as an integer, and presented as an octal number.
|
A type specifier that says what type the argument data should be treated as. Possible types:
|
X - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).
|
See also: printf(), sprintf(), sscanf(), fscanf(), vsprintf(), and number_format().
|
Example 1. sprintf(): zero-padded integers
|
äŸ 1 sprintf(): zero-padded integers
|
$money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; / / echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); / / echo $formatted will output "123.10 "
|
äŸ 2 sprintf(): formatting currency
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
Note that the length parameter is optional and if not specified the entire string will be written.
|
fputs() 㯠fwrite() ã®å¥åã§ããã¹ãŠã®é¢ã§åäžã§ãã length ãã©ã¡ãŒã¿ã¯ãªãã·ã§ã³ã§ããã æå®ãããªãå Žåãæååå
šäœãæžãããããšã«æ³šæããŠäžããã
|
fread() reads up to length bytes from the file pointer referenced by handle.
|
(PHP 3, PHP 4)
|
?php / / get contents of a file into a string $filename = "/ usr / local / something.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle);?
|
fread() 㯠fp ãæã ãã¡ã€ã«ãã€ã³ã¿ããæé« length ãã€ã èªã¿èŸŒã¿ãŸããèªã¿èŸŒã¿ã¯ã length ãã€ãå èªã¿èŸŒãŸããããEOFã«éãããã®ããããæ©ãæ¹ã®äºè±¡ã«ããäžæ¢ ãããŸãã
|
?php $filename = "c:\\files\\somepic.gif"; $handle = fopen ($filename, "rb"); $contents = fread ($handle, filesize ($filename)); fclose ($handle);?
|
泚æ ãã€ããªãšããã¹ããã¡ã€ã«ã®åœ¢åŒãç°ãªãã·ã¹ãã (ããªãã¡ Windows)ã§ã¯ã fopen() ã® mode ãã©ã¡ãŒã¿ã«'b' ãæå®ããŠãã¡ã€ã«ããªãŒãã³ããå¿
èŠããããŸãã
|
Prev
|
fwrite(), fopen(), fsockopen(), popen(), fgets(), fgetss(), fscanf(), file(), fpassthru() ãåç
§äžããã
|
Prev
|
(PHP 3, PHP 4)
|
Converts a date from the French Republican Calendar to a Julian Day Count.
|
æ¥ä»ãããã©ã³ã¹é©åœæŠãããŠãªãŠã¹ç©ç®æ¥ã«å€æããŸãã
|
This more than covers the period when the calendar was in use.
|
ãããã®ã«ãŒãã³ã¯ã1ãã14幎ãŸã§(ã°ã¬ãŽãªãŠã¹æŠã®1792幎9æ22æ¥ãã 1806幎9æ22æ¥)æ¥ä»ãã®ã¿ã倿ããŸãã ãã®æéã¯ããã©ã³ã¹é©åœæŠã䜿çšãããŠããæéãååã«ã«ããŒããŠããŸãã
|
This function is EXPERIMENTAL.
|
(PHP 4 = 4.0.4)
|
Use this function at your own risk.
|
ãã®é¢æ°ã¯ã å®éšç ãªã¹ããŒã¿ã¹ã«ãããŸããããã¯ããã®é¢æ°ã® åäœã颿°åãããã§æžãããŠããããšå
šãŠãPHPã®å°æ¥ã®ããŒãžã§ã³ã§äºå ãªã倿Žãããå¯èœæ§ãããããšãæå³ããŸããæ³šæãåèµ·ãããšãšãã«èªå ã®ãªã¹ã¯ã§ãã®é¢æ°ã䜿çšããŠäžããã
|
Prev
|
ãã®é¢æ°ã¯ã çŸåšã®ãšããè©³çŽ°ãªæ
å ±ã¯ãããŸãããåŒæ°ã®ãªã¹ãã®ã¿ã èšè¿°ãããŠããŸãã
|
(PHP 4 = 4.0.1)
|
(PHP 4 = 4.0.1)
|
If only two parameters were passed to this function, the values parsed will be returned as an array.
|
颿° fscanf() 㯠sscanf() 㫠䌌ãŠããŸããã handle ãæããã¡ã€ã«ããå
¥å ãååŸããæå®ãããã©ãŒããã format ã«åº ã¥ãè§£éãè¡ããŸãããã®é¢æ°ã®ãã©ã¡ãŒã¿ãäºã€ã ãã®å ŽåãåŠçã ããå€ã¯é
åãšããŠè¿ãããŸãã仿¹ããªãã·ã§ã³ã®ãã©ã¡ãŒã¿ãæå® ãããå Žåããã®é¢æ°ã¯ã代å
¥ãããå€ã®æ°ãè¿ããŸãããªãã·ã§ã³åŒ æ°ã¯åç
§æž¡ããšããå¿
èŠããããŸãã
|
The optional parameters must be passed by reference.
|
äŸ 1 fscanf() ã®äŸ
|
This means that even a tab \t in the format string can match a single space character in the input stream.
|
äŸ 2users.txt
|
$handle = fopen ("users.txt" ,"r"); while ($userinfo = fscanf ($handle, "%s\t%s\t%s\n")) {list ($name, $profession, $countrycode) = $userinfo; / /... do something with the values} fclose($handle);
|
fread(), fgets(), fgetss(), sscanf(), printf(), sprintf() ãåç
§äžããã
|
Prev
|
(PHP 3, PHP 4)
|
Sets the file position indicator for the file referenced by handle .The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence, whose values are defined as follows:
|
fp ãæããŠãããã¡ã€ã«ã®ãã¡ã€ã«äœçœ®èå¥å ããã¡ã€ã«ã»ã¹ããªãŒã äžã® offset ãã€ãç® ã«ã»ããããŸããæ°èŠäœçœ®ã¯ããã¡ã€ã«ã®å
é ããã®ãã€ãæ°ã§ èšãããŸãããã㯠whence ã§æå®ããäœçœ®ã« offset ã远å ããããšã«ããåŸãããŸãã ãã®å€ã¯ã以äžã®ããã«å®çŸ©ããã£Yã
|
SEEK_CUR - Set position to current location plus offset.
|
whence ãæå®ããªãå ŽåãSEEK_SETãæå®ããã ãšä»®å®ããŸãã
|
If whence is not specified, it is assumed to be SEEK_SET.
|
æåãããš0ãè¿ããããã§ãªããã°-1ãè¿ããŸããEOFããå
ã® äœçœ®ã«ã·ãŒã¯ããŠããšã©ãŒãšã¯ãªããªãã®ã§æ³šæããŠäžããã
|
May not be used on file pointers returned by fopen() if they use the "http: / / "or "ftp: / /" formats.
|
"http://"ãŸãã¯"ftp://"ãã©ãŒãããæå®ã® fopen () ã«ããè¿ããããã¡ã€ã«ãã€ã³ã¿ã«å¯ŸããŠã¯äœ¿ããªãã§äžããã
|
The whence argument was added after PHP 4.0.0.
|
泚æ åŒæ° whence ã¯PHP 4.0.0以éã§è¿œå ãããŸããã
|
Prev
|
ftell() ããã³ rewind() ãåç
§äžããã
|
Prev
|
(PHP 3, PHP 4)
|
For UDP connections, you need to explicitly specify the protocol by prefixing hostname with 'udp: / /'.
|
泚æ ãœã±ããçµç±ã§ããŒã¿ãèªã¿æžãããéã®ã¿ã€ã ã¢ãŠããèšå®ããå¿
èŠãããå Žåã fsockopen() ã® timeout ãã©ã¡ãŒã¿ã¯ã ãœã±ããã«æ¥ç¶ããéã®ã¿é©çšãããããã socket_set_timeout() ã䜿çšããŠãã ããã
|
The optional timeout can be used to set a timeout in seconds for the connect system call.
|
PHP 4.3.0以éãOpenSSLãµããŒããæå¹ã«ããŠã³ã³ãã€ã«ããå Žåã hostname ã®åã«' ssl:// 'ãŸãã¯' tls:// 'ãä»å ããããšã«ãããTCP/IPçµç±ã§ãªã¢ãŒããã¹ãã« æ¥ç¶ããéã«SSLãŸãã¯TLSã¯ã©ã€ã¢ã³ãæ¥ç¶ã䜿çšããããšãã§ããŸãã
|
As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl: / /' or 'tls: / /' to use an SSL or TLS client connection over TCP / IP to connect to the remote host.
|
fsockopen() ã¯ããã¡ã€ã«ãã€ã³ã¿ãè¿ããŸãã ãã®ãã¡ã€ã«ãã€ã³ã¿ã¯ã (fgets(), fgetss(), fputs(), fclose(), feof() ã®ãããª) ä»ã®ãã¡ã€ã«é¢æ°ã§äœ¿çšå¯èœã§ãã
|
If the call fails, it will return FALSE and if the optional errno and errstr arguments are present they will be set to indicate the actual system level error that occurred in the system-level connect() call.
|
ã³ãŒã«ã«å€±æããå Žåã«ã¯ FALSE ãè¿ããããªãã·ã§ã³ã®åŒæ° errno ããã³ errstr ãæå®ãããŠããå Žåãã·ã¹ãã ã³ãŒã« connect() ã§çããå®éã®ã·ã¹ãã ã¬ãã«ãšã©ãŒã瀺ãããã«èšå®ãããŸãã errno 㯠0 ãªã®ã«é¢æ°ã FALSE ãè¿ãå Žåã connect() ãã³ãŒã«ããåã«ãšã©ãŒãçºçããããšã瀺ããŸãã ãã®å Žåãããããã¯ãœã±ããã®åæåã«åå ããããŸããåŒæ° errno ããã³ errstr ã¯åžžã«åç
§æž¡ãã§ããããšã«æ³šæããŠãã ããã
|
This is most likely due to a problem initializing the socket.
|
ç°å¢ã«ãã£ãŠã¯UNIXãã¡ã€ã³ãŸãã¯ãªãã·ã§ã³ã®æ¥ç¶ã¿ã€ã ã¢ãŠãã¯å©çš ã§ããŸããã
|
Depending on the environment, the Unix domain or the optional connect timeout may not be available.
|
ãœã±ããã¯ããã©ã«ãã§ãããã¯ã¢ãŒãã§éãããŸãã socket_set_blocking() ã䜿çšããŠã éãããã¯ã¢ãŒãã«åæããããšãã§ããŸãã
|
You can switch it to non-blocking mode by using socket_set_blocking().
|
äŸ 1 fsockopen() ã®äŸ
|
?php $fp = fsockopen( "udp: / /127.0.0.1", 13, $errno, $errstr); if (!$fp) {echo "ERROR: $errno - $errstr br \n";} else {fwrite($fp ,"\n"); echo fread($fp, 26); fclose($fp);}?
|
äŸ 2UDPæ¥ç¶ã®äœ¿çšæ³
|
The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data.
|
UDPãœã±ããã¯ããªã¢ãŒããã¹ããšã®æ¥ç¶ã確ç«ãããŠããªãå Žåã§ãã ãšã©ãŒãçºçããã«ãªãŒãã³ãããããã«èŠããããšãæã
ãããŸãã ãã®ãšã©ãŒã¯ããã®ãœã±ããã§ããŒã¿ãèªã¿æžãããéã«ã®ã¿æããã« ãªããŸãããã®åå ã¯ãUDPã"ã³ãã¯ã·ã§ã³ã¬ã¹"ã®ãããã³ã«ã§ããã å®éã«ããŒã¿ãéåä¿¡ããå¿
èŠãçãããŸã§ããªãã¬ãŒã·ã§ã³ã·ã¹ãã ã ãœã±ããçšã®ãªã³ã¯ã確ç«ããããšããªãããã§ãã
|
Prev
|
泚æ timeout 㯠PHP 3.0.9 ã§ãµããŒããããŸã ãããŸããUDP ã®ãµããŒã㯠PHP 4ã§è¿œå ãããŸããã
|
(PHP 4)
|
(PHP 4)
|
This function is similar to the stat() function except that it operates on an open file pointer instead of a filename.
|
ãã¡ã€ã«ãã€ã³ã¿fpã«ãããªãŒãã³ããããã¡ã€ã«ã®çµ±èšæ
å ±ãååŸã ãŸãããã®é¢æ°ã¯é¢æ° stat() ã«äŒŒãŠããŸããã ãã¡ ã€ã«åã®ä»£ããã«ãªãŒãã³ããããã¡ã€ã«ãã€ã³ã¿ãæå®ãããšããã ç°ãªããŸãã
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.