我在“CI-主计长”类别下添加了一些变量,如:
$data[ foo ] = bar ;
$data[ animal ] = dog ;
$data[ justin_beiber ] = terrible ;
自2006年以来 我希望这些变量能够在我的所有控制者手中,而且由于所有控制者都延伸到这个控制中心。 主计长,我估计这项工作将:
echo $data[ foo ];
die();
我将此事带入一名主计长兼主计长。 但它并没有产生任何结果。 如何做到这一点?
我在“CI-主计长”类别下添加了一些变量,如:
$data[ foo ] = bar ;
$data[ animal ] = dog ;
$data[ justin_beiber ] = terrible ;
自2006年以来 我希望这些变量能够在我的所有控制者手中,而且由于所有控制者都延伸到这个控制中心。 主计长,我估计这项工作将:
echo $data[ foo ];
die();
我将此事带入一名主计长兼主计长。 但它并没有产生任何结果。 如何做到这一点?
或许适当利用组合方案将有助于你。
rel=“nofollow” http://codeigniter.com/user_guide/libraries/config.html
你可以把 CI结构中任何地方的混淆起来。
并且根据您的变量的推测, 你们可以把保护var带给一个阶层,让他们从继承中看到,但我不认为这是这样做的最佳途径。 至少不了解为什么你不使用助手在任何地方都想要获得数据。
http://upshots.org/codeigniter/codeigniter-2-exping-the-native- Controller-ci_ Controller” rel=“nofollow” 扩展了主控制人,没有修改。 还确保你的控制员延长你的新的控制人(MY_ Controller)而不是原来的控制人,因为我们有这样的情况:
class MY_Controller extends CI_Controller {
// constructor and variables defined here
}
又注意到,如果你决定以这种方式使用,你必须称呼您的变数:$this->foo[条]
。 关于普通变量,电话($foo[条][条/代码>),请上CI=和
A couple of friends was discussing the use of inheritance and how to check if a subclass is of a specific type and we decided to post it here on Stack. The debate was about if you should implement a ...
Hi I have two classes, one called Instruction, one called LDI which inherits from instruction class. class Instruction{ protected: string name; int value; public: Instruction(string ...
I ve not used C++ in a while, and I ve become far too comfortable with the ease-of-use of real languages. At any rate, I m attempting to implement the Command pattern, and I need to map a number of ...
Suppose I have some code like this: class Base { public: virtual int Foo(int) = 0; }; class Derived : public Base { public: int Foo(int); virtual double Foo(double) = 0; }; ...
What is your opinion of this design decision? What advantages does it have and what disadvantages? Links: Embedding description
I want to extend the FileReference class of Flex to contain a custom property. I want to do this because AS3 doesn t let me pass arguments to functions through event listeners, which makes me feel sad,...
I have the following class structure: class InterfaceA { virtual void methodA =0; } class ClassA : public InterfaceA { void methodA(); } class InterfaceB : public InterfaceA { virtual ...
Consider the Java code below, what would happen if there were no paintComponent method in JPanel class? ... import javax.swing.JPanel; public class ShapesJPanel extends JPanel { public void ...