class Myclass { var$a; var$b function Myclass($pa){ echo$pa; } function pr(){ echo$this->a."__".$this->b; } }
function index(){ $pa=111; $this->load->library('myclass',$pa); }
复制代码
请问自己扩展类,
里的构造函数,带参数,怎么传进去?
@。@方法,属性用着都没问题,这个构造函数,的参数要怎么传进去?
A PHP Error was encounteredSeverity: Warning
Message: Missing argument 1 for Myclass::Myclass(), called in C:\phpweb\ci\system\libraries\Loader.php on line 931 and defined
Filename: libraries/Myclass.php
Line Number: 8
A PHP Error was encounteredSeverity: Notice
Message: Undefined variable: pa
Filename: libraries/Myclass.php
Line Number: 9
<?phpif(!defined('BASEPATH'))exit('No direct script access allowed'); class Someclass { function Someclass($params) { // Do something with $params } } ?>