Fatal error: Cannot access empty property
程序员文章站
2022-05-01 11:28:26
...
代码整合如下:
$db = MySQL::getIns();
}
}
class catModel extends Model{
protected $table = 'emec_cat';
public function addCat($date){
$sql = $this->db->Autoexpr($date);
return $this->db->qurey($sql);
}
}
class MySQL {
static protected $Ins;
protected $res;
static function getIns(){
if(self::$Ins instanceof self){
return self::$Ins;
}
self::$Ins = new MySQL();
return self::$Ins;
}
private function __construct(){
$this->res = 1;
}
protected function __destruct(){
mysql_close($link);
}
}
$date = array();
$date['cat_name'] = $_POST['cat_name'];
$date['parent_id'] = $_POST['parent_id'] + 0;
$date['intro'] = $_POST['intro'];
$catMode = new catModel();
$catMode->addCat($date);
?>
会出现:Fatal error: Cannot access empty property in F:\Apache2.2\htdocs\emec\test.php on line 9
去掉基类的abstract
问题依旧。
环境:apache2.2 php5.3.5
回复内容:
代码整合如下:
$db = MySQL::getIns();
}
}
class catModel extends Model{
protected $table = 'emec_cat';
public function addCat($date){
$sql = $this->db->Autoexpr($date);
return $this->db->qurey($sql);
}
}
class MySQL {
static protected $Ins;
protected $res;
static function getIns(){
if(self::$Ins instanceof self){
return self::$Ins;
}
self::$Ins = new MySQL();
return self::$Ins;
}
private function __construct(){
$this->res = 1;
}
protected function __destruct(){
mysql_close($link);
}
}
$date = array();
$date['cat_name'] = $_POST['cat_name'];
$date['parent_id'] = $_POST['parent_id'] + 0;
$date['intro'] = $_POST['intro'];
$catMode = new catModel();
$catMode->addCat($date);
?>
会出现:Fatal error: Cannot access empty property in F:\Apache2.2\htdocs\emec\test.php on line 9
去掉基类的abstract
问题依旧。
环境:apache2.2 php5.3.5
写多了一个$
上一篇: css宽度高度自适应
下一篇: PHP源码目录都有什么作用
推荐阅读
-
PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题 - 心中的飞梦
-
Fatal error: Cannot redeclare class 原因分析与解决办法
-
Cannot access protected property validate $scene
-
PHP严重致命错误处理:php Fatal error: Cannot redeclare class or function【转】
-
[VUE ERROR] Error in render: "TypeError: Cannot create property 'header' on boolean 'true'"
-
VS2017连接git出现Git failed with a fatal error:Empty reply from server的解决办法
-
vuejs路由使用的问题Error in render function: "TypeError: Cannot read property 'matched' of undefined"
-
Error in nextTick: "TypeError: Cannot set property 'xxx' of undefined"解决办法
-
fatal error RC1015: cannot open include file ‘targetver.h‘
-
pycorrector安装失败、kenlm安装失败,提示LINK : fatal error LNK1181: cannot open input file 'stdc++.lib'