(PHP 5 >= 5.1.2)
SplTempFileObject::__construct — ساخت شی فایل موقت
ساخت شی فایل موقت.
حداکثر مقدار حافظه (به بایت بطور پیشفض 2 MB) برای استفاده فایل موقت. اگر فایل موقت از این اندازه بزرگتر باشدبه فایلی در دایرکتوری موقت سیستم منتقل میشود
اگر max_memory منفی باشد تنها حافظه استفاده میشود . اگر max_memory صفر باشد حافظه استفاده نمیشود.
No value is returned.
ایجاد RuntimeException در صورت خطا
Example #1 مثال SplTempFileObject()
این مثال فایلی موقت در حافظه میسازد که میتوان از آن خواند یا در آن نوشت.
<?php
$temp = new SplTempFileObject();
$temp->fwrite("This is the first line\n");
$temp->fwrite("And this is the second.\n");
echo "Written " . $temp->ftell() . " bytes to temporary file.\n\n";
// Rewind and read what was written
$temp->rewind();
foreach ($temp as $line) {
echo $line;
}
?>
The above example will output something similar to:
Written 47 bytes to temporary file. This is the first line And this is the second.