(PHP 5 >= 5.1.0)
SplFileObject::__construct — ساخت شی جدید فایل
ساخت شی جدید فایل
فایل برای خواندن.
A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the List of Supported Protocols/Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
حالت باز کردن فایل. fopen() را برای فهرستی از حالات ممکن ببینید.
تعیین جستجو برای include_path filename.
منبع زمینه صحیح با استفاده از stream_context_create() ساخته میشود.
No value is returned.
ایجاد RuntimeException اگر filename باز نشود.
Example #1 SplFileObject::__construct() example
این مثال فایل فعلی را باز کرده و محتوای آن را خط به خط تکرار میکند.
<?php
$file = new SplFileObject(__FILE__);
foreach ($file as $line) {
echo $line;
}
?>
The above example will output something similar to:
<?php $file = new SplFileObject(__FILE__); foreach ($file as $line) { echo $line; } ?>