【发布时间】:2017-10-20 20:27:52
【问题描述】:
我就是想不通为什么会出现这个错误:
注意:未定义变量:/.../classname.class.php 第 33 行中的 authTime
class ClassName {
private $authTime = null;
const API_URL = '...';
const CLIENT_ID = '...';
const CLIENT_SECRET = '...';
private static $TOKEN = NULL;
public function __construct() {
$this->_authTime = $authTime; // <----- Line 33
if(!self::$TOKEN OR $this->AuthTime('GET') > 3600 OR !$this->_authTime) {
self::authorise();
}
}
public function getAuthTime() {
return $this->_authTime; // Returns NULL
}
【问题讨论】:
-
在哪里定义的?它是在构造函数声明之后使用吗?但从未宣布。为什么在属性前加下划线?
_authTime -
stackoverflow.com/review/suggested-edits/17688430 为什么那个编辑会在里面添加咆哮??
标签: php class variables null undefined