gpt4 book ai didi

php - 在 js .html() 方法中包含
转载 作者:行者123 更新时间:2023-11-28 14:02:18 27 4
gpt4 key购买 nike

如果我们有:

html('<a href="blabla.org">go here</a>') 

我们可以有 <?php在这种情况下,在 href 内添加标签,或者这是一个不好的做法?

谢谢。内存管理

最佳答案

当然,你可以拥有这些。只要知道里面的代码会在JS执行之前在服务器上执行即可。所以如果你有:

html('<a href="blabla.org"><?php echo 'go here'; ?></a>')

你的 Javascript 将变成:

html('<a href="blabla.org">go here</a>') 

执行 JS 时您无法影响 PHP 代码。

关于php - 在 js .html() 方法中包含 <?php 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4297223/

27 4 0

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