문제

I got this problem, with my PHP code. I'm building a FPDF-script, there should add pages to the book. Earlier in the code, the Table Of Contents is defines, and the order is saved in the class' public $pdf->order-array. The script reply's with:

Warning: Illegal offset type in /var/www/domain/labs/book/fpdf.php on line 573

Here's a stump of my code.

function GetPersons(){
    echo gettype($this->order);
    foreach($this->order as $key => $val){
        $this->MakePage("Blahblahblah");
    }
}

The $pdf->order is defined as following:

function MakeTOCChapter($cat, $lvl){
    $this->SetFont('Helvetica','',12);
    $q = DB::query("SELECT name, id FROM paragraphs WHERE category=%i ORDER BY name ASC", $cat);
    if(DB::count()) {
        foreach($q as $r) {
            $this->links[$r["id"]] = $this->AddLink();
            $this->Write(1,$lvl.$r["name"], $this->links[$r["id"]]);
            $this->order[]  = $r["id"];
            $this->Ln(5);
        }
    }
    $this->SetFont('Helvetica','B',12);
}
도움이 되었습니까?

해결책

The error was in a hole other part of the script, that haven't throwed errors before. FPDF already uses $links, and the my script is based on a custom extension of the FPDF class. So I overwrote it - but I don't know why the error didn't threw errors before.

Anyways, it works now; I changed my own $pdf->links to $pdf->mylinks :).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top