File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Original file line number Diff line number Diff line change @@ -240,6 +240,25 @@ it is called with the file as a :class:`Symfony\\Component\\Finder\\SplFileInfo`
240
240
instance. The file is excluded from the result set if the Closure returns
241
241
``false ``.
242
242
243
+ Reading contents of returned files
244
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245
+
246
+ .. versionadded :: 2.1
247
+ Method ``getContents() `` have been introduced in version 2.1.
248
+
249
+ The contents of returned files can be read with
250
+ :method: `Symfony\\ Component\\ Finder\\ SplFileInfo::getContents `::
251
+
252
+ use Symfony\Component\Finder\Finder;
253
+
254
+ $finder = new Finder();
255
+ $finder->files()->in(__DIR__);
256
+
257
+ foreach ($finder as $file) {
258
+ $contents = $file->getContents();
259
+ ...
260
+ }
261
+
243
262
.. _strtotime : http://www.php.net/manual/en/datetime.formats.php
244
263
.. _Iterator : http://www.php.net/manual/en/spl.iterators.php
245
264
.. _protocol : http://www.php.net/manual/en/wrappers.php
You can’t perform that action at this time.
0 commit comments