我奮力定義,我放在laravel文件夾結構在我的推證書路徑中的推證書路徑:尋找laravel
config/ios-push-notification-certificates/certificate.pem
在我APNS類我想找到正確的道路用它來推動,那麼:
class APNS {
private $certificate = __DIR__ . "/ios-push-notification-certificates/production/certificate.pem";
(...)
}
但我得到一個錯誤:
syntax error, unexpected '.', expecting ',' or ';'
如何正確引用路徑?
我想:
private $certificate = config_path() . "/ios-push-notification-certificates/production/certificate.pem";
但這返回錯誤
expression is not allowed as field default value
您必須將成員變量初始化爲靜態。你可以在類之外定義它,'define('CERTIFICATE_FILE',__DIR__。'/ /certificate.pem');'然後'class APNS {private $ certificate = CERTIFICATE_FILE;' –
Cyclonecode