Php 在控制器codeigniter中从函数到函数获取数据
我是codeigniter的新手,遇到了一个问题。你能帮我理解如何从1控制器中的函数获取数据吗?我试过用这样的简单代码Php 在控制器codeigniter中从函数到函数获取数据,php,function,codeigniter,Php,Function,Codeigniter,我是codeigniter的新手,遇到了一个问题。你能帮我理解如何从1控制器中的函数获取数据吗?我试过用这样的简单代码 public function cow() { $first=$this->input->post('name'); } public function bird() { // how to display variable $first = " hello world" in here } 我希望你们能帮助我,伙计们:)。如果这两者是同
public function cow() {
$first=$this->input->post('name');
}
public function bird() {
// how to display variable $first = " hello world" in here
}
我希望你们能帮助我,伙计们:)。如果这两者是同一个控制器,您可以使用
$this
访问该功能
public function cow() {
$first= 'some text';
return $first; # Add this
}
public function bird() {
echo $this->cow();
}
注意:如果您从表单获取输入,则无法通过bird函数访问它
如果这两者是同一控制器,则可以使用
$this
访问该功能
public function cow() {
$first= 'some text';
return $first; # Add this
}
public function bird() {
echo $this->cow();
}
注意:如果您从表单获取输入,则无法通过bird函数访问它
很乐意帮忙:)你能再帮我一次吗?怎么了?解释我将再次创建帖子,请等待并乐于帮助:)你能再次帮助我吗?怎么了?解释我将再次创建帖子,请稍候