路径 php中'.'和'..'还有'./'和'../'

./当前目录(就是当前执行文件所在目录)
../上级目录
/ 这个才是根目
文件名/ 同级目录

例子如图

 

1、cart下的index.php

1)要引用Public->css->index.css      <link rel="stylesheet" href="../public/css/index.css"> ,

2)引用header.php  <?php  include '../header.php'  ?>

 

2、class.php

1)要引用Public->css->index.css      <link rel="stylesheet" href="public/css/index.css"> ,

2)引用header.php  <?php  include '../header.php'  ?>

 

          


posted on 2017-07-12 21:18  michellexiaoqi  阅读(635)  评论(0编辑  收藏  举报