首页 > 解决方案 > 在php中访问控制器的私有变量

问题描述

我创建了一个控制器和一些视图:

Controller
   Private $importantValues;

  Public function1
       Render view2

  Public function2
       Render view3

  Public function3 
       Call function4

  Private function4
       save something in db
end controller


view1
  call function1

View2
  With post call function2

View3 
  With post call function3

为什么 $importantValues 只存在于 function1 和 function2 中?在其他功能中,它被重置。

标签: phpclassvariablescontroller

解决方案


推荐阅读