Basit henüz bir if deyimi ile sorun yaşıyorsanız görünüyor

0 Cevap php

Ben kodu ve kod tek parça Bu sınıf sadece çalışan her şeyi durdurur ve ben neden anlamaya kuramıyorum var.

Senaryo: ajax ile çağrıldığında yöntem bir cevapta olarak json göndereceğiz, kod dışında çalışıyor koşulu eğer.

        if(false) // this stops the script
        {
        $menu[] = new jsTreeNode('node','nodeid');
        }
        $menu[] = new jsTreeNode('node');

Gerçek i true koymak veya fiili koşul doğru olduğunda çalışıyor ama yanlış sadece bütün komut durursa durum, iki değerler ve sadece yanlış değil, bir karşılaştırılması ise. Herhangi bir fikir?

Edit:

public function __construct($title, $nodeID = NULL)
{
    $this->data = new stdClass();
    $this->data->title = $title;
    $this->data->icon = 'assets/img/icons/'.strtolower($title).'.png';
    $this->attr = new stdClass();
    $this->attr->id = ($nodeID == NULL) ? strtolower($title) : strtolower($nodeID);

}

public function addChild($title, $nodeID = NULL)
{
    $this->children[] = new jsTreeNode($title, $nodeID);    
}

error_reporting throws no error.

0 Cevap