php包括后连接重置

时间:2011-08-11 15:32:33

标签: php apache include wamp

我一直在使用php-ews处理我正在进行的项目。

通过scandir循环和一些手动条目包含存储库

include ("php-ews/ExchangeWebServices.php");
include ("php-ews/EWS_Exception.php");
include ("php-ews/EWSType.php");
include ("php-ews/NTLMSoapClient.php");
include ("php-ews/NTLMStream.php");
include ("php-ews/NTLMStream/Exchange.php");

$dir    = '/wamp/www/intranet/dashboard/php-ews/EWSType/';
$files1 = scandir($dir);
foreach ($files1 as $value) {
if(preg_match('/\.php$/i', $value)){
$inc = "php-ews/EWSType/";
$inc .= $value;
include ($inc);
}}

然后我继续添加下一个包含

之一
include ("php-ews/NTLMSoapClient/Exchange.php");

并且该页面不再可以在任何浏览器中加载,从而在firefox中出现连接重置错误,但这是即时的而不是超时问题。在评论该行时,它会回来要求将其包括在内。

下面文件的内容

class NTLMSoapClient_Exchange extends NTLMSoapClient {
    /**
     * Username for authentication on the exchnage server
     * 
     * @var string
     */
    protected $user;

    /**
     * password for authentication on the exchnage server
     * 
     * @var string
     */
    protected $password;

    /**
     * Constructor
     * 
     * @param string $wsdl
     * @param array $options
     */
    public function __construct($wsdl, $options) {
        // verify that a user name and password were entered
        if (empty($options['user']) || empty($options['password'])) {
            throw new EWS_Exception('A username and password is required.');
        } // end if no user name and password were entered

        // set the username and password properties
        $this->user = $options['user'];
        $this->password = $options['password'];

        parent::__construct($wsdl, $options);
    } // end function __construct()
} // end class NTLMSoapClient_Exchange

如果您不再需要参考,代码存储库位于http://code.google.com/p/php-ews/source/browse/

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

如果你已经包含了这个类,它就会发生,我们会再次尝试包含该文件。 为防止这种情况,请使用include_once&还要检查使用代码是否再次包含该类(之前或之后)。