你插入数据的时候
$str="  ".你处理完的数据

解决方案 »

  1.   

    好像可以获取到\r\n的东东,你看\r\n前面是否还有空格,如果有就可以让它成一段,然后在前面加就可以了。
      

  2.   

    是不是这种效果?
    <?php
    if($_POST['submit']){
    $wtitle=$_POST['wtitle'];
    $wpost=strip_tags($_POST['wpost']); echo("<p>转换后:</p>$wpost");
    $wpost="  $wpost";
    $wpost=str_replace("\r\n","<br />  ",$wpost);
    echo("<p>转换后:</p>$wpost"); //$w->insert("insert into table(wtitle,wcontent) values ('$wtitle','$wcontent')");
    }
    ?><html>
    <head>
    <title>发表帖子</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    </head><body>
    <form name="form1" action="" method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <td>标题:</td>
                <td><input name="wtitle" type="text" size="78" /></td>
            </tr>
            <tr>
                <td>内容:</td>
                <td><textarea name="wpost" cols="60" rows="16"></textarea></td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                <br /><input name="submit" type="submit" value=" 发&nbsp;表 " />
                &nbsp;&nbsp;<input type="reset" value=" 重&nbsp;置 " />
                </td>
            </tr>
        </table>
    </div>
    </form>
    </body>
    </html>
      

  3.   


    <?php
    if($_POST['submit']){
        $wtitle=$_POST['wtitle'];
        $wpost=strip_tags($_POST['wpost']);    echo("<p>转换前:</p>$wpost");
        $wpost="  $wpost";
        $wpost=str_replace("\r\n","<br />  ",$wpost);
        echo("<p>转换后:</p>$wpost");    //$w->insert("insert into table(wtitle,wcontent) values ('$wtitle','$wcontent')");
    }
    ?>