php - 我不明白为什么我的变量是 NULL
问题描述
首先,对不起,我的英语不是很好。所以我有一个问题,当我显示我的变量时,他返回我 NULL 我不知道为什么:(
标签.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;
}
}
索引控制器.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>';
}
}
布局.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,
));
?>
头文件.php
<?php var_dump($this->newMenu12); ?>
答案:空
解决方案
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" } }
推荐阅读
- github - 平滑滚动在 github 页面上不起作用
- javascript - JQuery 重新获得对外部弹出窗口的控制
- discord - 通过 discord.py 将图像从特定文件夹推送到服务器
- javascript - 从 Rails 部分打开模态并传递部分参数
- html - html模板上的Gmail格式被搞砸了
- python - 使用 Zeep 覆盖 WSDL 文件中的类型
- neo4j - 如何使用 Neo4J 驱动程序查询节点和相关节点并为返回的节点添加属性
- oracle - 同一数据库中两个不同实例的性能问题
- node.js - Socket.io - io.in(room).emit() 不适用于加入回调的房间
- c++ - 有没有比这段代码更好的读取文件字符的方法?