php 中的 echo alert() 显示字符串中的所有内容。十月插件
echo alert() in php show everything in the string. octobercms plugin
我在 php 中回显 alert() 时遇到问题。它显示字符串中的所有内容。
echo "<script type='text/javascript'>alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');</script>";
Output
您可以在结束和开始 php 标签之间使用 javascript 代码,如下所示,
?>
<script type="text/javascript">
alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');
</script>
<?php
// rest of the php code will go here.
?>
或者请试试这个,
<?php
echo '<script type="text/javascript">';
echo 'alert("Thank you for your enquiry, we will contact you as soon as possible, have a nice day!");';
echo '</script>';
?>
解决方案:我通过删除所有内容来修复它。并在没有 alert() 的情况下直接回显消息。我不确定为什么它会这样,因为这是我的自定义插件。如果我找到此行为的来源,我会更新。谢谢大家的回复。
echo 'Email Successfully Sent. We will reply soon!';
我在 php 中回显 alert() 时遇到问题。它显示字符串中的所有内容。
echo "<script type='text/javascript'>alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');</script>";
Output
您可以在结束和开始 php 标签之间使用 javascript 代码,如下所示,
?>
<script type="text/javascript">
alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');
</script>
<?php
// rest of the php code will go here.
?>
或者请试试这个,
<?php
echo '<script type="text/javascript">';
echo 'alert("Thank you for your enquiry, we will contact you as soon as possible, have a nice day!");';
echo '</script>';
?>
解决方案:我通过删除所有内容来修复它。并在没有 alert() 的情况下直接回显消息。我不确定为什么它会这样,因为这是我的自定义插件。如果我找到此行为的来源,我会更新。谢谢大家的回复。
echo 'Email Successfully Sent. We will reply soon!';