超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<restore_include_pathset_magic_quotes_runtime>
Last updated: Fri, 22 Jun 2007

set_include_path

(PHP 4 >= 4.3.0, PHP 5)

set_include_path --  Sets the include_path configuration option

Description

string set_include_path ( string new_include_path)

Sets the include_path configuration option for the duration of the script. Returns the old include_path on success or FALSE on failure.

例子 1. set_include_path() example

<?php
// Works as of PHP 4.3.0
set_include_path('/inc');

// Works in all PHP versions
ini_set('include_path', '/inc');
?>

See also ini_set(), get_include_path(), restore_include_path(), and include().




add a note add a note User Contributed Notes
set_include_path
giovanni at giacobbi dot net
30-Sep-2003 10:58
You can append (or prepend, with proper changes) a directory to your include
path and preserve the original one this way:

<?php
$new_include_dir = "/home/user/php_includes";
print get_include_path() . "\n";
set_include_path(get_include_path() . ":" . $new_include_dir);
print get_include_path() . "\n";
?>

Output is:

.:/usr/local/lib/php
.:/usr/local/lib/php:/home/user/php_includes

Just remember that directories are separated by ':'

<restore_include_pathset_magic_quotes_runtime>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22