What do the dots mean in relative file path?

前端 未结 4 612
面向向阳花
面向向阳花 2020-12-17 15:44

I am new to programming and learning php on my own. I have two question about the following relative path of a file

$fp = fopen (\"$_SERVER[DOCUMENT_ROOT]/..         


        
4条回答
  •  有刺的猬
    2020-12-17 16:27

    I like to think that the two dots drop you down by one directory level, which usually refers to the parent folder. Imagine $_SERVER[DOCUMENT_ROOT] is root:

    root/
      index.php   // You are here
    
    orders/
      orders.txt  // You are reading this file
    

提交回复
热议问题