变量的问题

浏览:326 发布日期:2015/06/02 分类:求助交流 关键字: 变量
namespace Home\Controller;
use Think\Controller;
class RandController extends Controller {
private $rand = -1;

private function setRand($r){
$this->rand = $r;
}

private function getRand(){
return $this->rand;
}

public function index(){
$this->setRand(300);
$this->display();
}

public function check(){
$a = $this->getRand();
var_dump($a);
}
}

程序先执行index,后执行check,为嘛输出是$a=-1,值没变化,不是300呢,求大神指导。。。。
最佳答案
评论( 相关
后面还有条评论,点击查看>>