【问题标题】:How to pass 2 variables in viewVars如何在 viewVars 中传递 2 个变量
【发布时间】:2015-05-29 11:46:25
【问题描述】:

       $message[0]  = $unique_password[0]['users']['firstname'];
		
		$message[1]='Please click on this link to reset your password: http://test.com/reset_password?password='.$unique_password;


		$Email = new CakeEmail();
		$Email->config('smtp');
		***$Email->viewVars($message[0],$message[1]);***
		$Email->template('forgetpassword')
		->emailFormat('html')
		->to($email)
		->from('app@domain.com')
		->subject('Password: Urbanbeauty Network')
		->send();

我需要在 viewVars 中的视图 $message[0] 和 $message[1] 上发送两个变量。如何做到这一点?请帮忙。

【问题讨论】:

    标签: cakephp cakeemail


    【解决方案1】:

    你只需要这样做,$this->set('message', $message);然后在你看来你会有 $message[0] 和 [1]

    【讨论】:

    • 大卫,它说 set 是未定义的函数。谢谢大卫,我现在明白了。像这样 $Email->viewVars(array('message' => $message));
    猜你喜欢
    • 1970-01-01
    • 2013-01-30
    • 2016-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    • 1970-01-01
    相关资源
    最近更新 更多