<?php
$str='<html>
<head>
<title>Here-Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table border=0 width=100%>
<tr>
<td>测试</td>
</tr>
</table>
</body></html>';
$mysql_link=mysql_connect("localhost","root","");
mysql_select_db("test");
$query="insert into test (title,content) values ('test','".addslashes($str)."')";
$result=mysql_query($query);
$id=mysql_insert_id();
$query="select * from test where id='$id'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
echo $row[content];
?>
$str='<html>
<head>
<title>Here-Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table border=0 width=100%>
<tr>
<td>测试</td>
</tr>
</table>
</body></html>';
$mysql_link=mysql_connect("localhost","root","");
mysql_select_db("test");
$query="insert into test (title,content) values ('test','".addslashes($str)."')";
$result=mysql_query($query);
$id=mysql_insert_id();
$query="select * from test where id='$id'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
echo $row[content];
?>
解决方案 »
- jquery post 传值,接收问题
- php中怎么将18/9/2007日期格式转换为2007-09-18
- 请教关于ereg
- smarty的assign问题
- 如何判断文件内容是否包含,如何判断文件类型!
- 求救求救求救求救:php不能连接到mysql!!
- 请教一下如何在MYSQL的命令行下改变CHARACTER_SET_CILENT?CHARACTER_SET_CONNECT?
- linux9+mysql+php4.3.10+apache2+gd2这个配置如何进行?我怎么就这么难呢?
- PHP取FORM值的问题
- 恐怖:本想好好学think框架的,越学越头疼,为什么要这么复杂化;
- document.write 的参数中不能包含换行,怎么转换??
- 新手问题,急!
aaaa
bbbbb
ccccccc
这样的格式可以正常显示吗?就是不要把空格(or tab)去掉
$content=str_replace("\r\n","<br>",$row[content]);
$content=str_replace(" "," ",$content);
$content=nl2br($content);
aaaa
bbbbb
ccccccc
你这个内容是什么??包含HTML代码吗??还是直接从<textarea></textarea>中取出来的???
================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★ 浏览帖子速度极快![建议系统使用ie5.5以上]。 ★ 多种帖子实现界面。
★ 保存帖子到本地[html格式]★ 监视您关注帖子的回复更新。
★ 可以直接发贴、回复帖子★ 采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录!
★ 支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名 ●
可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
Http://www.ChinaOK.net/csdn/csdn.rar
Http://www.ChinaOK.net/csdn/csdn.exe [自解压]
$content=htmlspecialchars($_POST[content]);
$content=nl2br($content);正常輸出.