0

I am using cakephp 2.3 recently, and I came a doubt. I need to pass an array (variable), a plugin for a controller, both of which do not have direct connection.

I wonder of you, what better way to pass this variable, no link between two files?

For example I am researching using:

where I need to record this variable.

Configure::write('idParaImagens', $id);

and this where I need to read this variable.

Configure::read('idParaImagens');

the question is, how this variable will be widely used, this would be the best way to do this? for safety, certainty of reading and writing, etc., it would be best to do?

4

1 回答 1

0

我会在插件中编写方法,返回所需的数组。根据您需要此数据的位置,在插件的组件或插件的助手中。这些数据的来源将是直截了当的。

使用Configure::write()andConfigure::read()或 Session 在插件和应用程序之间传递变量将是以后维护的麻烦。

于 2013-06-15T17:36:25.583 回答