Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Filesystem] Add documentation for the readlink method#6956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
xabbuh merged 1 commit intosymfony:masterfromtgalopin:filesystem-readlink
Sep 21, 2016
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletionscomponents/filesystem.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,6 +195,40 @@ support symbolic links, a third boolean argument is available::
// does not support symbolic links
$fs->symlink('/path/to/source', '/path/to/destination', true);

readlink
~~~~~~~~

.. versionadded:: 3.2
The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method was introduced in Symfony 3.2.

:method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` read links targets.

PHP's ``readlink()`` function returns the target of a symbolic link. However, its behavior
is completely different under Windows and Unix. On Windows systems, ``readlink()``
resolves recursively the children links of a link until a final target is found. On
Unix-based systems ``readlink()`` only resolves the next link.

The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method provided
by the Filesystem component always behaves in the same way::

// returns the next direct target of the link without considering the existence of the target
$fs->readlink('/path/to/link');

// returns its absolute fully resolved final version of the target (if there are nested links, they are resolved)
$fs->readlink('/path/to/link', true);

Its behavior is the following::

public function readlink($path, $canonicalize = false)

* When ``$canonicalize`` is ``false``:
* if ``$path`` does not exist or is not a link, it returns ``null``.
* if ``$path`` is a link, it returns the next direct target of the link without considering the existence of the target.

* When ``$canonicalize`` is ``true``:
* if ``$path`` does not exist, it returns null.
* if ``$path`` exists, it returns its absolute fully resolved final version.

makePathRelative
~~~~~~~~~~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp