• 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

  • 相关阅读:
    hadoop2 作业执行过程之作业提交
    Hadoop各个服务端口列表
    基于 Nginx 和 FFmpeg 搭建流媒体服务器
    prometheus
    ubuntu 下dbus的环境搭建和使用
    Hadoop-Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster —
    Exception message: /bin/bash: line 0: fg: no job control
    P3942 将军令 [贪心]
    P3941 入阵曲
    P3941 入阵曲
  • 原文地址:https://www.cnblogs.com/xiaoyoucai/p/7308147.html
Copyright © 2020-2023  润新知