gpt4 book ai didi

javascript - ECHO 双单引号

转载 作者:行者123 更新时间:2023-11-30 10:03:55 27 4
gpt4 key购买 nike

我在 HTML 中的 php 代码

$i = 1;
echo "<input type='text' class='uborder help-80percent' maxlength='3' onkeypress='return isNumberKey(event)'' id='quantity_".$i."' onchange='updatetotalWeight(this.value, quantity_".$i.", current_quantity_".$i.", weight_".$i." )' />";

enter image description here

我想做我的:

updatetotalWeight(this.value, "quantity_1", "current_quanitity_1", "weight_1");

你知道如何让这个东西变成字符串吗?

最佳答案

您可以在双引号字符串中使用双引号,方法是用反斜杠转义它们 \":

echo "<input type='text' class='uborder help-80percent' maxlength='3' onkeypress='return isNumberKey(event)' id='quantity_".$i."' onchange='updatetotalWeight(this.value, \"quantity_".$i."\", \"current_quantity_".$i."\", \"weight_".$i."\" )' />";

关于javascript - ECHO 双单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30280770/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com