zoukankan      html  css  js  c++  java
  • dirname和include_once

    这样写的效果是一样的

    include_once dirname(dirname(__FILE__)) . "/define.php";
    include_once dirname(dirname(__FILE__)) . "define.php";

    __FILE__ 和 __DIR__ 的区别 

    <?php  $dir = dirname(__FILE__);  ?>
    在PHP5.3中,增加了一个新的常量__DIR__,指向当前执行的PHP脚本所在的目录。
    例如当前执行的PHP文件为 /www/website/index.php
    则__FILE__等于‘/www/website/index.php‘
    而__DIR__等于‘/www/website‘
     

    所以刚开始也可以这样写

       include_once dirname(__DIR__) . "/define.php";
            include_once dirname(__DIR__) . "define.php";
    杂念太多,必然根基浅薄
  • 相关阅读:
    JPA01
    mybatis入门
    PHP 循环- While循环
    PHP超级全局变量
    PHP 数组排序
    PHP数组
    PHP Switch语句
    PHP IF...Else语句
    PHP运算符
    PHP字符串变量
  • 原文地址:https://www.cnblogs.com/starshine-zhp/p/13204460.html
Copyright © 2011-2022 走看看