我有控制器有功能,我想通过它们使用一个变量
scanf
我尝试仅在一个函数(视图)中使用会话但会话范围 提前谢谢
答案 0 :(得分:2)
将其设为属性
class TrainerController extends \BaseController
{
private $variable;
public functionOne(){
$this->variable = "some data";
}
public functionTwo()
{
echo $this->variable; //outputs 'some data' IF this 1st method has already been called
}
}