I dont understand why my variable is NULL

家住魔仙堡 提交于 2019-12-31 05:09:12

问题


First of all, sorry my english isnt so good. So i have a problem, when i display my variable, he return me NULL and i dont know why :(

Label.php

class Services_Label extends Services_Abstract
{
    public function getlibelle()
    {
        $sRequest = 'SELECT NAME FROM menu WHERE id_application = 2';
        $this->executeQueries($sRequest);
        $aResult = $this->getAllRows();
        $this->freeStatement();
        return $aResult;
    }
}

IndexController.php

public function indexAction()
{
    $oMessage = new Services_Label();
    $toto = $oMessage->getlibelle();
    $this->view->newMenu12 = $toto;

    foreach ($toto as $data) {
        foreach($data as $key => $value) {
            echo $value[2] . '<br>';
        }
    }

Layout.php

<?php
echo $this->partial('/common/header.phtml', array(
    'notshowlogout' => (isset($this->notshowlogout) ? true : false),
    'profils' => $this->profils,
    'listeHabiUti' => $this->listeHabiUti,
    'libmenu' => $this->libmenu,
    'userName' => $this->userName,
    'siteName' => $this->siteName,
    'envName' => $this->envName,
    'newMenu12' => $this->newMenu12,
));
?>    

header.php

<?php var_dump($this->newMenu12); ?>

Answer : NULL


回答1:


var_dump($toto = $oMessage - > getlibelle()); = array(13) {
[0] => array(1) {
    ["name"] => string(15)
    "Prise en charge"
} [1] => array(1) {
    ["name"] => string(16)
    "Liste des d�p�ts"
} [2] => array(1) {
    ["name"] => string(19)
    "Saisie par flashage"
} [3] => array(1) {
    ["name"] => string(11)
    "Supervision"
} [4] => array(1) {
    ["name"] => string(20)
    "Supervision des flux"
} [5] => array(1) {
    ["name"] => string(28)
    "Suivi des flux informatiques"
} [6] => array(1) {
    ["name"] => string(14)
    "Administration"
} [7] => array(1) {
    ["name"] => string(17)
    "Contr�le des RADM"
} [8] => array(1) {
    ["name"] => string(17)
    "Contr�le des RPEC"
} [9] => array(1) {
    ["name"] => string(12)
    "Surveillance"
} [10] => array(1) {
    ["name"] => string(7)
    "Journal"
} [11] => array(1) {
    ["name"] => string(15)
    "Journal de bord"
} [12] => array(1) {
    ["name"] => string(16)
    "Audit des depots"
} } array(13) {
[0] => array(1) {
    ["name"] => string(15)
    "Prise en charge"
} [1] => array(1) {
    ["name"] => string(16)
    "Liste des d�p�ts"
} [2] => array(1) {
    ["name"] => string(19)
    "Saisie par flashage"
} [3] => array(1) {
    ["name"] => string(11)
    "Supervision"
} [4] => array(1) {
    ["name"] => string(20)
    "Supervision des flux"
} [5] => array(1) {
    ["name"] => string(28)
    "Suivi des flux informatiques"
} [6] => array(1) {
    ["name"] => string(14)
    "Administration"
} [7] => array(1) {
    ["name"] => string(17)
    "Contr�le des RADM"
} [8] => array(1) {
    ["name"] => string(17)
    "Contr�le des RPEC"
} [9] => array(1) {
    ["name"] => string(12)
    "Surveillance"
} [10] => array(1) {
    ["name"] => string(7)
    "Journal"
} [11] => array(1) {
    ["name"] => string(15)
    "Journal de bord"
} [12] => array(1) {
    ["name"] => string(16)
    "Audit des depots"
} }


来源:https://stackoverflow.com/questions/53371226/i-dont-understand-why-my-variable-is-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!