set_include_path设置路径但路径不起作用

I've read nearly all of the posts about set_include_path but I haven't found a post that I really understand yet.

I'm trying to use UserSpice for my logins on a new site. I already have a file structure for the site of course, and I thought I would be able to simply add the UserSpice folder to that structure and then use set_include_path to access all of the files within UserSpice. But I guess I just don't understand the function or paths in general.

This is my code: set_include_path(get_include_path() . PATH_SEPARATOR . 'C:\xampp\htdocs\mynewsite\userSpice');

This is the result: Fatal error: require_once(): Failed opening required 'users/init.php' (include_path='.;C:\xampp\php\PEAR;C:\xampp\htdocs\mynewsite\userSpice') in E:\xampp\htdocs\mynewsite\index.php on line 10

The 'users' folder is a subfolder of 'mynewsite/userSpice' so I thought that the path would allow access to that folder.

Can anyone help?

You have to use $_SERVER['DOCUMENT_ROOT'] to access to the required path:

require_once $_SERVER['DOCUMENT_ROOT'] .'/mynewsite/userSpice/users/init.php';

require_once $_SERVER['DOCUMENT_ROOT'] .'/mynewsite/userSpice/users/includes/header.php';

require_once $_SERVER['DOCUMENT_ROOT'] .'/mynewsite/userSpice/users/includes/navigation.php';