donpvtzuux37724 2017-12-21 09:09
浏览 104
已采纳

在魔术常量__FILE__的描述中,“符号链接已解决”是什么意思?

I'm using PHP 7.2.0

Below is a description of magic constant __FILE__ :

The full path and filename of the file with symlinks resolved. If used inside an include, the name of the included file is returned.

I didn't understand meaning of the clause "filename of the file with symlinks resolved"

Someone please make me understand the meaning of this clause with demonstrative suitable example of usage of magic constant __FILE__ accompanied by appropriate explanation.

  • 写回答

1条回答 默认 最新

  • dongre8505 2017-12-21 09:14
    关注

    Symlinks (symbolic links) are "shortcuts" you can create in the filesystem to point one directory entry at any arbitrary other directory entry. On a *NIX shell, something like:

    $ ln -s /foo/bar.php /baz
    

    This establishes /baz as a symlink to /foo/bar.php. Whichever file you use now, they're effectively both the same.

    Resolving symlinks means to look at a given path, recognise symlinks within it and replace them by the actual file path they point to. So, regardless of whether you do

    $ php /baz
    

    or

    $ php /foo/bar.php
    

    the __FILE__ constant will be resolved to the actual file path /foo/bar.php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理