一尘不染

致命错误:不在对象上下文中时使用$ this

php

这是有错误的部分。

致命错误:第6行/pb_events.php中不在对象上下文中时使用$ this

第6行是: $jpp = $this->vars->data["jpp"];

function DoEvents($this) {

    global $_CONF, $_PAGE, $_TSM , $base;

    $jpp = $this->vars->data["jpp"];

    $cache["departments"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_departments]}");
    $cache["locations"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_location]}");
    $cache["names"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_names]}");
    $cache["categories"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_categories]}");

非常感谢!欣赏!


阅读 434

收藏
2020-05-29

共1个答案

一尘不染

$这仅在方法中有意义,在函数中没有意义

还行吧

class Foo {
     function bar() {
          $this->...

这不是

function some() {
    $this->

//编辑:没有注意到他将“ $ this”作为参数传递

建议:只需将“ $ this”替换为“ $ somethingElse”

2020-05-29