php echo 中需要帮助按钮 href

Need Help button href in php echo

我有以下代码行:

//onclick="location.href='http://www.example.com'"
echo "<button type='button' class='single_add_to_cart_button button alt wdm_enquiry' style='background:rgb(0, 171, 0) none repeat scroll 0% 0%';>Ihre ".$post_name." Testversion anfordern!</button>";

onclick 需要包含在 echo 中,但我做不到。

谁能帮帮我?

你可以这样写:

echo "<button type='button' onclick=\"location.href='http://www.example.com'\" class='single_add_to_cart_button button alt wdm_enquiry' style='background:rgb(0, 171, 0) none repeat scroll 0% 0%';>Ihre $post_name Testversion anfordern!</button>";