简体   繁体   中英

PHP Get all Symlink files?

Is there any way to get all symlinks for specific file?

So let say, I have a file here: home/test/a.png

and I have created 2 symlinks for this file:

home/test-a.png
home/testb/a.png

In this circumstances, is there any function to get those 2 symlinks back?

Something like

get_all_symlinks('home/test/a.png')

which will pass following:

array(
'home/test-a.png',
'home/testb/a.png'
)

Or at least, is there any function or way to get to know if this file has symlink(s) to it?

You can use a combination of scandir with is_link and then readlink to create the array. Here are the docs for these functions, http://php.net/manual/en/ref.filesystem.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM