I always used retrieving the Operating system environment, and then get all current include path and then set the include path
<?php
$delim = (PHP_OS == "WIN32" || PHP_OS == "WINNT") ? ';': ':';
ini_set('include_path', ".");
ini_set('include_path', ini_get('include_path') . "my_library");
ini_set('include_path', ini_get('include_path') . "my_library/include");
?>
Here is the code, which simplifies the above logic of detecting OS environment and then to get include_path and appending new one -
<?php //Set the include path set_include_path(get_include_path() . PATH_SEPARATOR . '/my_library' . PATH_SEPARATOR . '/my_library/include/' ); ?>
2 Responses
aquiroga
January 8th, 2008 at 3:11 pm
1You can replace
$delim = (PHP_OS == “WIN32″ || PHP_OS == “WINNT”) ? ‘;’: ‘:’;With the constant:
DIRECTORY_SEPARATORGanesh H S , Bangalore, India
January 8th, 2008 at 11:49 pm
2aquiroga -
You are right DIRECTORY_SEPARATOR is equivalent to PATH_SEPARATOR
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Archives
Blogroll
Recent Comments