我有了下一个功能的控制器:将函数的变量传递给控制器中其他函数的代码?
class controller {
function __construct(){
}
function myfunction(){
//here is my variable
$variable="hello"
}
function myotherfunction(){
//in this function I need to get the value $variable
$variable2=$variable
}
}
我感谢你的答案。如何将一个函数的变量传递给codeigniter控制器中的其他函数?
另外,根据“myotherfunction”是否可以通过url调用,您可以使用下划线进行命名,以使其默认情况下不可用,例如'private function _myotherfunction(){}'。 – Matthew