php 文件路径设置 set_include_path(); get_include_path();

时间:2023-03-09 00:55:29
php 文件路径设置 set_include_path(); get_include_path();
<?php
set_include_path($string); //设置路径 get_include_path(); // 获取当前的路径 //例如:文件路径为:
//D:/phpweb/demo/test.php
//test.php内容为:
echo "hi"; //D:/phpweb/index.php
//index.php内容为: set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__)."/demo/");
require_once("test.php"); //用 PATH_SEPARATOR分格目录(window 为 ; linux 为 :) // 这样就可以调用test.php文件里面的内容了
?>