J
J
Jack Cooper2016-06-15 16:04:12
Yii
Jack Cooper, 2016-06-15 16:04:12

Yii not outputting print_r?

Good day to all.
I am just starting to learn yii framework php.
Why doesn't the print_r function work in /protected/modules/ , that is, as I understand it in the module files ? I want to output the contents of the $data array . How can I see it?

public function getSupplierDataList($article, $id) {


        $request = array(
            'method' => 'SupplierCrossPrice',
            'key' => $this->key,
            'timeout' => $this->timelimit,
            'request' => $request_array,
        );
        $data = $this->getApiRequest($request);

        print_r($data);

    return array();
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SharuPoNemnogu, 2016-06-15
@negmat

in yii2 there is a VarDumper helper, it seems to be called, look at the doc. A "budget option"

echo "<pre>"; 
var_dump($data); 
echo "</pre>"; 
die;

is it normal that your function returns array() and not $data?

M
Muhammad, 2016-06-15
@muhammad_97

var_dump($data);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question