所以我有PHPWhoIs位于我的服务器的根目录plugins/phpwhois-4.2.2
。默认情况下包括PHPWhoIs所有脚本
我能够通过包括它喜欢用在PHP脚本的Whois()
类:
include_once('../../../plugins/phpwhois-4.2.2/whois.main.php');
$whois = new Whois();
但我试图让我的服务器默认包含这个文件。我尝试添加这我的php.ini
include_path=".:/plugins/phpwhois-4.2.2/whois.main.php"
,并确认它带着var_dump(ini_get('include_path'));
,但随后说,类Whois()
不存在。
我也注意到我覆盖了默认include_path
。
如何添加此路径以包含在默认情况下在任何脚本中工作?
我该如何使用auto_prepend_file? – 2012-01-05 00:24:37
这个想法是每次我想为每个站点使用它时,不必包含文件。 – 2012-01-05 00:26:51
@stevether - auto_prepend_file的__auto__部分表示自动,即不必每次都手动包含。你可以通过设置auto_prepend_file =“/ plugins/phpwhois-4.2.2/whois.main来使用它。php“在您的php.ini中,然后在您的脚本中实例化类 – 2012-01-05 07:30:17