php static
RT,用CI框架在写一个php网页,现发现static关键字不太会用,简化代码如下:
class A extends CI_Controller{
private static $num = 0;
public function f1(){
self::$num = 1;
this->load->view('v1');
}
public function f2(){
if(self::$num === 1){
this->load->view('v2');
}else{
this->load->view('v3');
}
}
}