关于在mysql字段中保存html代码,然后显示出来的问题

knifewolf88 2006-03-05 05:51:07
我在mysql保存了一段html代码,但是对于表格代码显示出来时不支持属性的双引号。

如下:
<table width="163" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>

如上代码,border为0,但显示出来时表格始终有border。字段属性我是设成的mediumtext

请问是为什么啊?
...全文
781 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ZqBokt 2006-03-07
  • 打赏
  • 举报
回复
你可以把" 引号去掉了再进库,或者使用 stripslashes_deep()
例子 1. A stripslashes() example

<?php
$str = "Is your name O\'reilly?";

// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>



注: stripslashes() is not recursive. If you want to apply this function to a mutli-dimensional array, you need to use a recursive function.

例子 2. Using stripslashes() on an array

<?php
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);

return $value;
}

// Example
$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));
$array = stripslashes_deep($array);

// Output
print_r($array);
?>

上例将输出:

Array
(
[0] => f'oo
[1] => b'ar
[2] => Array
(
[0] => fo'o
[1] => b'ar
)

)
Alan820221 2006-03-07
  • 打赏
  • 举报
回复
不要引号试一下
看行不行?
knifewolf88 2006-03-07
  • 打赏
  • 举报
回复
谢谢ZqBokt(时窗) ,谢谢各位!已经搞定了!
积木 2006-03-06
  • 打赏
  • 举报
回复
哎……全是转义字符闹的。
meiking 2006-03-06
  • 打赏
  • 举报
回复
你这应该是 php.ini 的设置问题.

找到 : magic_quotes_gpc = On
改为 : magic_quotes_gpc = Off
knifewolf88 2006-03-06
  • 打赏
  • 举报
回复
代码是border=\"0\"

为什么啊?怎么改呢?
knifewolf88 2006-03-06
  • 打赏
  • 举报
回复
改为 : magic_quotes_gpc = Off
了还是不行啊


%……………………EW¥
helloyou0 2006-03-05
  • 打赏
  • 举报
回复
用“查看源文件”看你客户端的html

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧