[英]php htmlawed removing href link
I am capturing some content using tinyMCE, and then posting the content back to php script to store in database.我正在使用 tinyMCE 捕获一些内容,然后将内容发布回 php 脚本以存储在数据库中。
I am using htmlawed to remove anything nasty.我正在使用 htmlawed 删除任何讨厌的东西。
The content of the $_POST variable is $_POST 变量的内容是
<p>This is a link <a href=\"https://www.bbc.co.uk\">https://www.bbc.co.uk</a></p>
I am then using this code on the server然后我在服务器上使用此代码
$Details = $_POST["Details"];
$config = array('elements'=>'* -script -object'); //dont allow any scripts
$SanitizedDetails = htmLawed($Details, $config);
SanitizedDetails then contains this SanitizedDetails 然后包含这个
<p>This is a link <a href="\">https://www.bbc.co.uk</a></p>
It has removed the contents of href (just left a backslash)它已经删除了 href 的内容(只留下了一个反斜杠)
Please could somebody help with config for htmlawed请有人帮助配置 htmlawed
You need to delete the first backslash \
from href=\
and the last one from uk\
and you're ready to go.您需要从
href=\
中删除第一个反斜杠\
,从uk\
中删除最后一个反斜杠,然后您就可以使用 go。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.