$version = \jamesiarmes\PhpEws\Client::$ews_version;
が$ews_version
が可能な値を持つクライアント設けられた可変であるがどのように
Uncaught Error: Access to undeclared static property:
例外スコープ定義演算子への定期的な変数を提供する:
$ews_version = 'VERSION_2007';
$ews_version = 'VERSION_2007_SP1';
$ews_version = 'VERSION_2009';
$ews_version = 'VERSION_2010';
$ews_version = 'VERSION_2010_SP1';
$ews_version = 'VERSION_2010_SP2';
$ews_version = 'VERSION_2013';
$ews_version = 'VERSION_2013_SP1';
$ews_version = 'VERSION_2016';
は手動でのconstを提供するが、正常に動作します:
$version = \jamesiarmes\PhpEws\Client::VERSION_2013_SP1;
助けてください。ありがとう。
コード:
$ews_version = $_REQUEST['version']; // User posted version (i.e. VERSION_2009)
// Set connection information.
$host = $ews_host;
$username = $ews_username;
$password = $ews_password;
$version = \jamesiarmes\PhpEws\Client::$ews_version;
$client = new \jamesiarmes\PhpEws\Client($host, $username, $password, $version);
をあなたはその変数が一般的かつ静的に定義されているのを見ますか?それはエラーが言ったように、そこにはありません。 – Rafael
なぜ定義する必要があります静的またはパブリックですか?クラスや関数の外にある通常の変数です。私の編集 –
を参照してください。クライアントクラスは 'protected 'である' $ version'変数を定義しています。つまり、この場合はアクセスできません。これはインスタンス変数でもあり、静的には定義されていないため、試行している方法でアクセスすることはできません。クライアントのバージョンを取得する場合は、この変数を返すpublic getVersion関数を持つようにそのクラスを変更する必要があります。 – Rafael