在PHP手冊中,我們可以讀到:fwrite()返回什麼類型?
fwrite() returns the number of bytes written
好...但什麼樣的事情「寫入的字節數」?
Binary string?二進制數字?流?詮釋?
我在這裏有點失落。
問候
在PHP手冊中,我們可以讀到:fwrite()返回什麼類型?
fwrite() returns the number of bytes written
好...但什麼樣的事情「寫入的字節數」?
Binary string?二進制數字?流?詮釋?
我在這裏有點失落。
問候
Description
int
fwrite (resource $handle , string $string [, int $length ])
它成功返回一個int,由類型名稱只是函數名前所示。它返回的錯誤FALSE:
fwrite() returns the number of bytes written, or FALSE on error.
的整數,或者失敗布爾值false。
$fh = fopen('/tmp/bar', 'w');
$bytes = fwrite($fh, 'Hello, world.');
var_dump($bytes); // output: int(13)
我發現的情況是fwrite
返回NULL 與錯誤E_NOTICE
。
可能發生這種情況時網絡流中止。
Notice: fwrite(): in .... on line ....
不簡單'echo'回答你的問題? – 2010-09-10 11:01:38
然而,在這種情況下,我瞭解到我們能夠在php手冊中看到返回值,這一點我從未引起過多關注。總是有價值的問。總是。 :) – MEM 2010-09-10 11:58:04
這是副作用,但它不回答我的問題。爲什麼你不能獲得這個價值,打印出來看看。 – 2010-09-10 14:09:17