3

いくつかの背景のために、私はテンプレートスパークでcodeigniterを使用しています。

だから私のコントローラーには次の機能があります

public function information()
{     
$this->load->library('session');
$developer_id = $this->session->userdata('developer_id');
$this->load->model("Developer_model");
$information = $this->Developer_model->get_developer($developer_id);
$this->template->set('information', (array) $information); 
$this->template->build('dashboard/information'); 
}

私の見解では、私はそのように反響しています

<?php echo $information['email']; ?>

なんらかの理由で「メッセージ:未定義のインデックス:メール」が返ってきます

これは私の最初の質問なので、はっきりしないことを願っていますが、基本的にはデータベースから$ informationを取得し、一連のアイテムの1つにすぎない電子メールをエコーアウトしようとしています。

$ informationをvar_dumpすると、次のようになります。

object(stdClass)#21 (2) { ["timestamp"]=> int(1353444880991) ["result"]=> object(stdClass)#22 (3) { ["email"]=> string(21) "anothertest@gmail.com" ["api_key"]=> string(64) "de0f57acfc018882841b3255e89da11cb238160e84a66fe5b45bda8c51137c72" } } 

助けてくれてありがとう、その前の2か月間だけcodeigniterで作業していて、文字通り、いくつかの本当にマイナーなhtmlナンセンス以外にコーディングをしていません。

4

2 に答える 2

5

vardumpを見ると、情報クラス内に2番目のクラス「結果」があります。$ information["result"]["email"]を試してください;

于 2012-11-20T21:00:36.320 に答える
3

モデルで応答->結果を返します。応答の代わりに。そして、次を使用できます... $ information ['email']; ...動作するはずです

于 2012-11-20T21:19:43.927 に答える