添加onclick事件后出错

Following is my php code which i am using to return image, but i am getting errors. Kindly let me know what i did wrong. The error does not happen if I remove onclick event from the following code.

return ('<img onclick="window.open('http://google.com','_blank')" src="'.$content.'" alt=""/>');

You didn't escape single quotes:

return ('<img onclick="window.open(\'http://google.com\', \'_blank\')" src="'.$content.'" alt=""/>');

You have to escape characters:

return ('<img onclick="window.open(\'http://google.com\',\'_blank\')" src="'.$content.'" alt=""/>');

Use back slash like it

return ('<img onclick="window.open(\'http://google.com\',\'_blank\')" src="'.$content.'" alt=""/>');