标签:type ret 方法 res span exit 传递 class new
<?php //给构造函数传达参数 header("Content-type: text/html; charset=utf-8"); class test { private $user_ids=array("66645","66586"); private $user_id; //构造传递参数 public function __construct($user_id) { $this->user_id=$user_id; if(!in_array($this->user_id, $this->user_ids)) { $res[‘status‘]=0; $res[‘msg‘]="你的账号不在测试账号内"; // ajax_return($res);exit; print_r($res);exit; } } public function test1($user_id) { echo "<br/>"; echo "___1111"; } } $user_id=66642; //new类的时候带参数 $obj=new test($user_id); $obj->test1($user_id); ?>
标签:type ret 方法 res span exit 传递 class new
原文地址:http://www.cnblogs.com/hnbiao/p/6163798.html