set-include-path

define my own BASE_PATH vs. set_include_path?

落爺英雄遲暮 提交于 2019-12-05 22:43:58
问题 I learned of the function set_include_path(). All this time, I defined a constant in the config.php file define('BASE_PATH', '/var/www/mywebsite/public_html/'); And in all subsequent php files, I would include like so include(BASE_PATH.'header.php'); include(BASE_PATH.'class/cls.data_access_object.php'); Is there any advantage with the constant approach vs. the set_include_path approach and vice versa? Is the constant approach obsolete? 回答1: Using set_include_path() (or ini_set('include_path'

define my own BASE_PATH vs. set_include_path?

穿精又带淫゛_ 提交于 2019-12-04 03:57:35
I learned of the function set_include_path(). All this time, I defined a constant in the config.php file define('BASE_PATH', '/var/www/mywebsite/public_html/'); And in all subsequent php files, I would include like so include(BASE_PATH.'header.php'); include(BASE_PATH.'class/cls.data_access_object.php'); Is there any advantage with the constant approach vs. the set_include_path approach and vice versa? Is the constant approach obsolete? Using set_include_path() (or ini_set('include_path', ...)) allows you to specify multiple folders that would contain your library code. For instance, if your