Parse error: syntax error, unexpected T
I am getting this error: Parse error: syntax error, unexpected T_STRING in /Applications/XAMPP/xamppfiles/htdocs/core/functions/users.php on line 8
The piece of code that im getting an error is:
function recover($mode, $email) {
$mode = sanitize($mode);
$email = sanitize($email);
$user_data = user_data(user_id_from_email($email), 'first_name', 'username');
if ($mode == 'username') {
email($email, 'Your username', 'Hello " . $user_data['first_name'] . ", nn Your username is: " . $user_data['username'] . " ');
} elseif ($mode == 'password') {
$generated_password = substr(md5(rand(999, 999999)), 0, 8);
die($generated_password);
}
}
How can i fix this? Thanks in advance
You syntax is incorrect for the following line:
email($email, 'Your username', 'Hello " . $user_data['first_name'] . ", nn Your username is: " . $user_data['username'] . " ');
You can replace it with:
email($email, 'Your username', "Hello " . $user_data['first_name'] . ", nn Your username is: " . $user_data['username'] . " ");
But a much cleaner approach is to embed variables in your string:
email($email, 'Your username', "Hello {$user_data['first_name']}, nn Your username is: {$user_data['username']} ");
链接地址: http://www.djcxy.com/p/69484.html
上一篇: 解析错误:语法错误,意想不到的'public'(T
下一篇: 解析错误:语法错误,意外的T