【发布时间】:2021-10-28 10:37:17
【问题描述】:
方法addNew()中变量$jwtoken的值为null。我想将auth() 方法值“some val”传递给addNew() 方法/函数。
class Employees extends CI_Controller
{
public $jwtoken = null;
public function __construct()
{
parent::__construct();
}
public function auth() {
if(condition is true){
$this->jwtoken = 'val1';
}
else{
$this->jwtoken = 'val2';
}
}
public function addNew()
{
$this->auth();
echo $this->jwtoken;
}
// ..
}
【问题讨论】:
标签: php codeigniter-3