如何显示双引号""在php中

How to show double quotes " " in php?

本文关键字:quot php 何显示 显示      更新时间:2023-09-26

我有一个插入查询,要插入的数据来自文本区域。插入后,我想在其他文本区域显示此内容。我有双引号的问题。。。我不知道如何管理它,因为输出文本区域不会显示包含"的文本!

我尝试了htmlentitles和其他功能,但什么也没发生。你能帮帮我吗?非常感谢。

这是输入代码:

//database connection
//taking datas from the text areas input in the form
$title = trim(stripslashes($_POST['title']));
$title = mysql_real_escape_string($title);

这是输出代码:

//select query
$title=mysql_result($results, $i,"T_TITLE");
//and with javascript I want show it in a textarea that have name="EDITtitle"
document.EDITform.EDITtitle.value="<?php echo $title; ?>";

如果在输入中我有-问题与"代码N1"在网站上,我如何显示文本与",没有问题?

您正在寻找htmlspecialchars函数。

document.EDITform.EDITtitle.value="<?php echo htmlspecialcahrs($title); ?>";
string addslashes ( string $str )

该函数用于在引用之前添加斜线

在插入数据库之前使用"addslashes"函数

http://php.net/manual/en/function.addslashes.php

stripslashes($str);

该函数用于删除斜杠

使用"条带斜线"功能查看内容

http://php.net/manual/en/function.stripslashes.php