php - HTML PHP 字符串特殊字符转义
问题描述
只是想知道是否可以使用 PHP 编写链接按钮,字符串中有这么多特殊字符。
$link='index.php?topic=transactions&content=transaction_adjustment&tx_number='.$tx_number;
echo '<button type="button" onclick="window.location.href="'.$link.'"">Adjust</button>';
解决方案
尝试以下操作:
$link='index.php?topic=transactions&content=transaction_adjustment&tx_number='.$tx_number;
echo '<button type="button" onclick="window.location.href=\''.$link.'\'">Adjust</button>';
推荐阅读
- python - 搞砸了点子,得到“ImportError:找不到入口点('console_scripts','pip')”
- c# - 如何在 RPN(反向波兰表示法)中使用 IF-ELSE?
- angular - 实时验证令牌以存储在 NgRx 状态?
- azure - 如何使用 | 将 CSV 转换为 JSON 使用逻辑应用程序的分隔符
- amazon-web-services - Nginx 配置作为 AWS S3 的反向代理
- google-sheets - 创建总额减去百分比论坛la
- r - 添加图层时填充和颜色图例消失
- laravel - Ubuntu 18.04 上的 Laravel Forge 自定义 VPS
- php - $_POST 没有使用 bindValue 插入到帖子表中,而其他字段被插入
- reactjs - WP Gutenberg,如何将变量从后端(保存函数)传递到前端(在保存函数输出中呈现的 React 应用程序)?