zoukankan      html  css  js  c++  java
  • 16)PHP, set_include_path

    代码展示:

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     5     <title>网页标题</title>
     6     <meta name="keywords" content="关键字列表" />
     7     <meta name="description" content="网页描述" />
     8     <link rel="stylesheet" type="text/css" href="" />
     9     <style type="text/css"></style>
    10     <script type="text/javascript"></script>
    11 </head>
    12 <body>
    13 <?php
    14     //设定配置文件中的include_path的值——代码中的设定只对当前代码有效。
    15     //而且这里的设定,无需重启apache
    16     set_include_path('D:0-CodePhpStormDemodemo01');
    17     
    18     //更常见的做法:
    19     $path = get_include_path();    //先获取系统的include_path值
    20     $path_new = $path . PATH_SEPARATOR ."C:/";
    21     //PATH_SEPARATOR: 是系统常量,代表目录分割符:
    22     //        unix系列中,是“:”
    23     //        window系列中,是“;”
    24     set_include_path($path_new);    //再来设定“自己”想要加入的paht路径
    25     //这样就不会破坏(丢失)原有路径设定
    26     
    27     echo "<p>当前工作目录:" . getcwd() .'</p>';    //getcwd()获得当前工作目录
    28     
    29     //相对路径:
    30 //    include 'c.php';
    31     
    32 ?>
    33 </body>
    34 </html>

    结果展示:

    当前工作目录:D:0-CodePhpStormDemodemo01

  • 相关阅读:
    机器学习——EM算法
    机器学习——贝叶斯分类器
    机器学习——朴素贝叶斯法
    论文解读(SimCLR)《A Simple Framework for Contrastive Learning of Visual Representations》
    机器学习——数据增强
    机器学习——正则化方法Dropout
    ResNet
    机器学习——最小二乘法
    机器学习——K-Means算法
    机器学*——K*邻算法(KNN)
  • 原文地址:https://www.cnblogs.com/xiaoyoucai/p/7308147.html
Copyright © 2011-2022 走看看