[英]PHP Security test gives me critical Reflected XSS warning for GetHTMLValueString, how can i fix?
嘗試將值轉換為HTML 實體
<?php $depo_gin = '<a>1</a>'; ?>
<td>...</td><td><?php echo htmlentities( GetHTMLValueString($depo_gin) ); ?></td>
或者
<?php $depo_gin = '<a>1</a>'; ?>
<td>...</td><td><?php echo htmlspecialchars( GetHTMLValueString($depo_gin) ); ?></td>
結果為 HTML:
<td>...</td><td><a>1</a></td>
文檔:
https://www.php.net/manual/en/function.htmlentities.php
https://www.php.net/manual/en/function.htmlspecialchars.php
如果您只需要來自 html 內容的值
嘗試使用功能strip_tags
<?php
var_dump(
strip_tags('<a>1</a>')
); # result: 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.