简单的cakephp问题 [英] simple cakephp problem

查看:86
本文介绍了简单的cakephp问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个非常简单的事情,我真的应该知道,但我试图学习cakephp没有做过多的php之前。我被告知这是一个愚蠢的想法,但我做的很有趣,所以我这样做。

I know this is a really simple thing that I really should know but I'm trying to learn cakephp without having done much php before. I've been told thats a stupid idea, but I'm doing it for fun and so I'm doing it.

我想将数组从一个控制器操作传递到另一个控制器操作,然后传递给视图。我有:

I want to pass an array from one controller action to another controllers action and then pass it to the view. I have:

sponges_controller.php

sponges_controller.php

$info = $this->data;
$this->redirect(array('controller'=>'baths', 'action'=>'dashboard', $info));

baths_controller.php

baths_controller.php

function dashboard($info) {
    $this->set('info', $info);
}

,然后

<?php echo debug($info); ?> 

我尝试了各种方法,但无法使其工作。它所做的就是打印出Array()

I've tried various ways but can't make it work. All it does is print out Array()

Plz帮我! :) Julia

Plz help me! :) Julia

推荐答案

我不知道在不同的控制器传递数据,但在同一个控制器,我们可以做像一个函数调用通过写这样的东西。

I'm not sure about the passing data in different controllers but within the same controller we can do it just like a function call by writing something like this.

$this->function_name($info);

这将完美地按预期工作。我没有尝试过这种类型的数据传递在不同的控制器功能。

This will perfectly work as intended. I've not tried this type of data passing in different controllers function.

这篇关于简单的cakephp问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆