Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP在从mySQL字段返回变量时添加引号。_Php_Html_Echo - Fatal编程技术网

PHP在从mySQL字段返回变量时添加引号。

PHP在从mySQL字段返回变量时添加引号。,php,html,echo,Php,Html,Echo,我有一个问题,已经将一些编码的html存储到mySQL数据库中。 但当我解码并回显变量时。它在输出中添加双引号 代码: $content=mysqli\u fetch\u数组($r); $data=$content['contentHTML']; $html=html_实体_解码($data,ENT_COMPAT,'UTF-8'); $output=解决方案:使用mysqli\u real\u escape\u字符串编码html,然后存储在mySql数据库中解决方案:使用mysqli\u rea

我有一个问题,已经将一些编码的html存储到mySQL数据库中。 但当我解码并回显变量时。它在输出中添加双引号

代码:

$content=mysqli\u fetch\u数组($r);
$data=$content['contentHTML'];
$html=html_实体_解码($data,ENT_COMPAT,'UTF-8');

$output=解决方案:使用mysqli\u real\u escape\u字符串编码html,然后存储在mySql数据库中

解决方案:使用mysqli\u real\u escape\u字符串编码html,然后存储在mySql数据库中

你能给我们举一个例子说明
contentHTML
列中的内容吗?你正在打印一个srting,我要访问你的网站,哈哈&;书信电报;脚本类型='text/javascript'&;燃气轮机;window.location='; &;lt/剧本及;燃气轮机;从数据库$data=$content['contentHTML'];//echo mb_detect_编码($data);$html=html_实体_解码($data,ENT_COMPAT,'UTF-8')$数据编码很简单,你能给我们举一个例子说明
contentHTML
列中的内容吗?你正在打印一个srting,我要访问你的网站,哈哈哈&;书信电报;脚本类型='text/javascript'&;燃气轮机;window.location='; &;lt/剧本及;燃气轮机;从数据库$data=$content['contentHTML'];//echo mb_detect_编码($data);$html=html_实体_解码($data,ENT_COMPAT,'UTF-8')$数据编码是ASCII码
    $content = mysqli_fetch_array($r);
    $data    = $content['contentHTML'];
    $html    = html_entity_decode($data,ENT_COMPAT, 'UTF-8');
    $output     = <<<MY_MARKER
$html
MY_MARKER;
echo $output;
$html = "I am going to hax0r your site, hahaha! <script type='text/javascript'> window.location = 'http://www.example.com/' </script>"
$str = <<<MY_MARKER
<script type="text/javascript">
document.write("Hello World2!<br>");
</script>
MY_MARKER;

echo $str;
$userInput = "I am going to hax0r your site, hahaha! <script type='text/javascript'> window.location = 'http://www.example.com/' </script>";
$str = <<<MY_MARKER
$userInput
MY_MARKER;