Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.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 如何将符号保存并回显到数据库中的符号数据_Php_Mysql_Textarea_Special Characters - Fatal编程技术网

Php 如何将符号保存并回显到数据库中的符号数据

Php 如何将符号保存并回显到数据库中的符号数据,php,mysql,textarea,special-characters,Php,Mysql,Textarea,Special Characters,我有一个带有textarea的简单表单 例如: <textarea name="script"></textarea> 当第一次在DB中添加脚本时-一切正常,但当我编辑它时,在“中转换 有没有办法保存和编辑这些数据,并保留每个字符 更新:如何通过该帖子发送 <textarea name="script">&quot;</textarea> ” 使用htmlentities()和html\u entity\u decode()存储在数据

我有一个带有textarea的简单表单 例如:

<textarea name="script"></textarea>
当第一次在DB中添加脚本时-一切正常,但当我编辑它时,在
中转换

有没有办法保存和编辑这些数据,并保留每个字符


更新:如何通过该帖子发送

<textarea name="script">&quot;</textarea>
使用
htmlentities()
html\u entity\u decode()
存储在数据库中

$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

$b = html_entity_decode($a);

echo $a; // I'll "walk" the &lt;b&gt;dog&lt;/b&gt; now

echo $b; // I'll "walk" the <b>dog</b> now
$orig=“我现在就去遛狗”;
$a=htmlentities($orig);
$b=html_实体_解码($a);
回声$a;//我现在“走”b日志/b
回声$b;//我现在就去遛狗

这看起来像是工作,但不要。核心问题似乎出现在textarea,当我第一次从DB回显数据时,所有数据都正确:
replace(/“/g,”)但当我再次提交表单时,
。为什么使用
replace
函数,请给出
php
代码,用于
存储
检索
数据库中的数据
。这将帮助我找出并测试它。@Tahiaji最后一个版本是写入数据:
mysql\u查询(“更新FOTtable SET value=”。base64\u编码(htmlentities($value)).“'WHERE object='”、“$object.”和读取数据:
html_实体_解码(base64_解码($this->read_one(“从FOTtable中选择值,其中object='“$object.”))
$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

$b = html_entity_decode($a);

echo $a; // I'll "walk" the &lt;b&gt;dog&lt;/b&gt; now

echo $b; // I'll "walk" the <b>dog</b> now