我在下面创建了一个数组:
$email[] = $post[0];
$email[].= $post[2];
结果是:
$email = Array ( [JESSICA] => jessica.doe@laerdal.com )
然后我将它传递给类构造函数:
$email_user = new Email($id,$email,$subject,$heading,$messages,$keys);
该类如下所示:
class Email extends Users {
protected $id;
public $strings;
public $user_email;
public $subject;
public $heading;
public $messages;
public $keys;
public function __construct($id,$user_email,$subject,$heading,$messages,$keys) {
parent::__construct($id);
$this->user_email = $user_email;
$this->subject = $subject;
$this->heading = $heading;
$this->messages = $messages;
$this->keys = $keys;
如果我测试看看 $this->user_email 是否是一个数组,使用:
if(is_array($this->user_email)) {
echo "TRUE";
}
它返回假。怎么来的?
*我发现了问题,与名为 $email 的变量发生冲突。谢谢您的帮助。