1
類
我得到在我的服務器錯誤訪問私有財產,PHP無法裏面
<?php
class Encryption{
private $_encryptionkey;
public function setEncryption($key){
$this->_encryptionkey = $key;
}
}
當我打電話
$enc = new Encryption();
$enc->setEncryption("abcd123");
我收到錯誤
PHP Fatal error: Uncaught Error: Cannot access private property Encryption::$_encryptionkey
此錯誤保顯示事件我將_encryptionkey更改爲受保護的,但如果我更改爲公共,錯誤消失。
我的服務器上運行PHP 7.1.0版本使用爾康版本3.0.3
它的工作: - https://eval.in/707425 –
http://stackoverflow.com/questions/4361553/what-is-the-difference-between-public-private-and-protected閱讀此 –
我想知道它的'phalcon'具體的 –