写入textarea中文本前总是空格,写入数据库后,再次写出后也是有空行,写入文件也有很多空格,怎样让其中的文本具顶显示啊?

解决方案 »

  1.   

    <textarea name="t_images" id="t_images" rows="2" cols="2" style="width: 30%">
       <?php echo $data->images;?>
    </textarea>
      

  2.   


    显示NULL,怎么回事?
      

  3.   

    可能是你php的代码有问题, 实在不行就去掉str_replace去掉空格和回车
      

  4.   

    提交后才有数据var_dump($POST['t_images']);//看看
      

  5.   


    <br />
    <b>Warning</b>:  Wrong parameter count for str_replace() in <b>D:\xampp\htdocs\mesh\splash.php</b> on line <b>179</b><br />
      

  6.   

    这个怎么写啊?echo str_replace();
      

  7.   


    用ltrim  
    参考
    http://www.w3school.com.cn/php/func_string_ltrim.asp
      

  8.   

    我发现我的问题是,在textarea中显示时,总是上下位置间居中显示。怎么解决
      

  9.   

    就是啊,那怎样才能使我的文字在textarea中具顶显示显示呢,就是前面不要空行
      

  10.   


    <textarea name="t_images" id="t_images" rows="2" cols="2" style="width: 30%"><?php echo $data->images;?></textarea>试下全部内容写到一行去
      

  11.   

    找css文件id为t_images的样式修改
    margin:0;padding:0;或者
    style="width: 30%;margin:0;padding:0;"