V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
darasion
V2EX  ›  问与答

<input /> 和 <textarea></textarea> 的长度限制是多少?我有个很长很长的文本,提交的时候发现总会有截断,我在文档中没找到。

  •  
  •   darasion · Sep 16, 2011 · 6713 views
    This topic created in 5342 days ago, the information mentioned may be changed or developed.
    4 replies    1970-01-01 08:00:00 +08:00
    frittle
        1
    frittle  
       Sep 16, 2011
    除非是<input type="text" maxlength="123" />之类的不然好像没限制吧?刚试了<input type="text" /> 几万个字符都没问题。如果是在存进db时被截断的话问题应该是table field字符的长度设置。
    chone
        2
    chone  
       Sep 16, 2011
    html没限制http也没限制,用GET方式提交的时候会受浏览器URL长度限制。不同的浏览器不一样,有的有限制,有的没限制,IE最小是2048字节(可以把这个看成GET的安全提交上限)。你可以试试POST
    Livid
        3
    Livid  
    MOD
    PRO
       Sep 16, 2011
    除此之外还有可能是 web server 也会限制 client request body size。

    比如很多 nginx 装好之后默认这个限制是 1M。
    bigdude
        4
    bigdude  
       Sep 18, 2011
    nginx,php都有限制
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2305 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 15:53 · PVG 23:53 · LAX 08:53 · JFK 11:53
    ♥ Do have faith in what you're doing.