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文件里面的内容了
?>

  

posted @ 2014-02-10 20:59  好记性还真不如烂笔头  阅读(212)  评论(0编辑  收藏  举报